题目链接: A. Sonya and Queries time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty…
题目链接:http://codeforces.com/contest/714/problem/C C. Sonya and Queries time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today Sonya learned about long integers and invited all her friends to…
题目描述:  A Simple Task time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or…
题目 给出一个n*m的01矩阵, 让你最多改变k个里面的值(0变1,1变0), 使得0.1的连通分量是矩阵.输出最少步数 1 ≤ n, m ≤ 100; 1 ≤ k ≤ 10 题解: 如果01连通分量是矩形, 那么矩形一定是这样的: 0101010 1010101 0101010 1010101 (上面的01代表子矩阵块). 也就是每一行要么是相同,要么是相反的. 如果n>k, 肯定有一行是不能改变的,那么枚举这一行,然后其余的要么变相同,要么变相反,看最少的步数. 如果n<k ,那么可以枚举…
题意: 给你N个点的一幅图,初始图中有M条边,每次操作可以使得一个点连接的所有点变成一个团,问你最少多少次操作可以使得整个图变成一个团. 解法: 因为N很小 所以我们可以二进制压缩来表示一个点与其他点之间的关系.二进制的第i位代表标号位i+1的人.例如标号为1的人认识标号为3与5还有7的人,标号为1的二进制压缩结果就为0000000000000000001010101(标号为i的人肯定认识他自身). //https://www.cnblogs.com/FxxL/p/8095418.html #i…
题目链接 Clear The Matrix 题意 给定一个$4 * n$的矩形,里面的元素为$'.'$或$'*'$.现在有$4$种正方形可以覆盖掉$'*'$,正方形的边长分别为$1,2,3,4$. 求把整个矩形变成全$'.'$的最小代价. 考虑状压DP 设$f[i][j]$为前$i$列已经全部变成'.',第$i + 1$到第$i + 4$列的这$16$个格子状态为$j$的最小花费. 这$16$个格子标号如下 $0$   $4$   $8$   $12$ $1$   $5$   $9$   $13…
F Fighting for Triangles Description Andy and Ralph are playing a two-player game on a triangular board that looks like the following: 1 234 5 7 86 910 11 13 14 16 1712 15 18 At each turn, a player must choose two adjacent vertices and draw a line se…
C. Sonya and Queries time limit per test:1 second memory limit per test: 256 megabytes input:standard input output: standard output Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty mul…
C. Sonya and Queries 题目连接: http://codeforces.com/contest/714/problem/C Description Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries,…
B. Preparing Olympiad You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made. A problemset for the contest must consist of at le…