Codeforces Round #584】的更多相关文章

链接: https://codeforces.com/contest/1209/problem/E2 题意: This is a harder version of the problem. The difference is only in constraints. You are given a rectangular n×m matrix a. In one move you can choose any column and cyclically shift elements in th…
链接: https://codeforces.com/contest/1209/problem/D 题意: The legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks!…
链接: https://codeforces.com/contest/1209/problem/C 题意: You are given a sequence of n digits d1d2-dn. You need to paint all the digits in two colors so that: each digit is painted either in the color 1 or in the color 2; if you write in a row from left…
链接: https://codeforces.com/contest/1209/problem/B 题意: It is a holiday season, and Koala is decorating his house with cool lights! He owns n lights, all of which flash periodically. After taking a quick glance at them, Koala realizes that each of his…
链接: https://codeforces.com/contest/1209/problem/A 题意: You are given a sequence of integers a1,a2,-,an. You need to paint elements in colors, so that: If we consider any color, all elements of this color must be divisible by the minimal element of thi…
传送门 A. Paint the Numbers 签到. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 105; int n; int a[N]; bool used[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; for(int i = 1; i <= n; i…
-- A,B 先秒切,C 是个毒瘤细节题,浪费了很多时间后终于过了. D 本来是个 sb 题,然而还是想了很久,不过幸好没什么大事. E1,看了一会就会了,然而被细节坑死,好久才过. 感觉 E2 很可做,一直想 E2,结果想了大半了就最后一点没想出来. 此时 G1 更多人做了.然而我不会啊-- 没救了.掉分掉惨了. A 排个序,如果前面有它的约数就染成同色,否则开个新颜色. 下面这个代码,因为刚开始以为要输出方案,所以比较丑. #include<bits/stdc++.h> using nam…
Contest Page A sol 每次选最小的,然后把它的所有倍数都删掉. #include<bits/stdc++.h> using namespace std; int read(){ int a = 0; char c = getchar(); bool f = 0; while(!isdigit(c)){f = c == '-'; c = getchar();} while(isdigit(c)){ a = a * 10 + c - 48; c = getchar(); } ret…
题意:https://codeforc.es/problemset/problem/1209/E2 给你一个n(1-12)行m(1-2000)列的矩阵,每一列都可以上下循环移动(类似密码锁). 问你移动后,对每一行取最大值,这些最大值再加起来的MAX是多少. 思路: 1. 首先我们有一个思维上的优化,就是我们已知n很小,m会很大.我们按照每列最大的元素值为排序标准对列进行排序. 我们发现最多只会用到前n列(就是全取每列的最大值). 2. 枚举每列对行生效的数(就是该行这个数最大),也就是有2^n…
题意:https://codeforc.es/contest/1209/problem/D 有n个点心,有k个人,每个人都有喜欢的两个点心,现在给他们排个队,一个一个吃,每个人只要有自己喜欢的点心就会吃掉(不会留给后面的人). 如果有人什么都没吃就会不开心,问怎么安排使不开心的人最少. 思路: 看成一个图的问题,点心是节点,人是一条边.对于每个连通块,总会有一个人吃两个点心,其他人吃一个(其中一个是其他人也就吃掉了的). 可以保证这样是最优的,所有每个连通块的答案是连通数 x-1. #defin…