Problem B - Card Constructions (构造)】的更多相关文章

                                                                                        Problem 2260 Card Game Accept: 37    Submit: 117Time Limit: 3000 mSec    Memory Limit : 32768 KB Problem Description 有如下取牌游戏: 1. 桌面上有n张卡牌从左到右排成一行,每张卡牌上有一个数字: 2. 游…
Problem H. Hard TestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description Andrew is having a hard time preparing his 239-th contest for Petrozavodsk. This time the solution to the problem is based on Di…
大意: 求构造n个pair, 每个pair满足 对于每k组, 让$b_i$为$[1,k]$, $g_i$循环右移就好了 int n, k, cnt; int main() { scanf("%d%d", &n, &k); if (n>(ll)k*(k-1)) return puts("NO"),0; puts("YES"); int cnt = 0; REP(i,1,n) { int cur = i+1; REP(j,1,k…
感觉这种构造题好妙啊,可我就是想不到诶. 给出一张无自环的有向图,回答一个独立集,使得图中任意一点都可以被独立集中的某一点两步之内走到. 具体构造方案如下: 下标从小到大枚举点,如果该点没有任何标记,则将其标记为$-1$,即答案的候选点,并把它能一步走到的未访问的点标记为$1$,即不会成为答案的点. 下标从大到小进行第二次枚举,如果该点被标为$-1$并且没有被丢弃,则选则该点,并把它能一步走到的点丢弃. 我们来考虑它的正确性: 显然它是一个独立集.唯一的问题在与它有可能出现两个同为$-1$的点相…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5402 Problem Description Teacher Mai is in a maze with n rows and m columns. There is a non-negative number in each cell. Teacher Mai wants to walk from the top left corner (1,1) to the bottom right corn…
If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10);And ai(0<=i<=9) can only be 0 or 1 . Sample Input 10 9999 1 1 1 1 1 1 1 1 1 1 20 500 1 0 1 0 1 0 1 0 1 0   Sample Output 45 104 #include <iostr…
链接 大意: 给定有向图, 求选择一个点集$S$, 使得$S$任意两点不相连, 且对于不属于$S$的任意点$x$, 均存在$S$中的点$y$, 使得$d(x,y)<=2$, $d(x,y)$为从$x$到$y$的最短路 对于图G, 任选一点M, 删除d(M,x)=1的所有x以及M, 得到生成子图G', 假设已经得到G'的解S', 若S'中有点x使得d(x,M)=1,则S'就是G的解, 否则S'并M构成G的解 #include <iostream> #include <algorith…
题目链接: http://codeforces.com/contest/1174/problem/D 题意: 构造一个序列,满足以下条件 他的所有子段的异或值不等于$x$ $1 \le a_i<2^n$ 输出一个最长的这样的序列 数据范围: $1 \le n \le 18$$1 \le x<2^{18}$ 分析: 比赛的时候搞混$subsegment$和$subsequence$,前者为子段一定要连续,后者为子序列可以不连续 赛后看的官方题解 假设构造的序列为$a_i$,它的前缀异或和为$b_…
题目链接: https://codeforces.com/contest/1159/problem/D 题意: 构造一个长度为$n$的$01$串,最小特殊连续字串的长度为$k$ 也就是,存在最小的$k$,满足,有一个长度为$k$的连续字串没有出现过两次 数据范围: $1 \leq k \leq n \leq 100\,000$$(k \bmod 2) = (n \bmod 2)$ 分析: 典型的构造题,构造了一下午的错误题意,…
补题地址:https://zjusummer.contest.codeforces.com/ Contents ZJU-ICPC Summer 2020 Contest 1 by Group A Problem A. MUG Problem B. Count Angles Problem F. Balloons Tower Defence ZJU-ICPC Summer 2020 Contest 2 by Group B Problem A. The Number of Good Interva…