rated

Educational Codeforces Round 73 (Rated for Div. 2)

南笙酒味 提交于 2020-04-06 04:16:39
题目链接: https://codeforces.com/contest/1221 A - 2048 Game 随便搞搞。 B - Knights 题意:在一个n*n的棋盘中,每个格子放一个黑马或者白马。求一种放置方案使得互相攻击的异色马最多。 题解:奇偶染色。 C - Perfect Team 题意:有c个代码手,有m个口胡怪,有x个倒水哥。要求组成尽可能多的三人队,每个三人队至少有一个代码手和一个口胡怪。 题解:首先先把1:1:1的队伍尽可能配出来,这时如果用完了代码手或者口胡怪,就得到了答案。否则是用完了倒水哥。那么两种极端的情况分别是:全部都是2个代码手配1个口胡怪,全部都是1个代码手配2个口胡怪,这两种直接算出来,剩下的总是有办法配出尽可能多的三人队。 void TestCase() { ll c, m, x; scanf("%lld%lld%lld", &c, &m, &x); ll ans = 0; ll tmp = min(c, m); if(x >= tmp) ans += tmp; else { ans += x; c -= x; m -= x; tmp = min(c, m); if(c >= 2 * m) ans += m; else if(m >= 2 * c) ans += c; else ans += (m + c) / 3; } printf("

Educational Codeforces Round 79 (Rated for Div. 2) D. Santa's Bot

北慕城南 提交于 2020-03-21 10:26:47
链接: https://codeforces.com/contest/1279/problem/D 题意: Santa Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of ki different items as a present. Some items could have been asked by multiple kids. Santa is really busy, so he wants the New Year Bot to choose the presents for all children. Unfortunately, the Bot's algorithm of choosing presents is bugged. To choose a present for some kid, the Bot does the following: choose one kid x equiprobably among all n

Educational Codeforces Round 83 (Rated for Div. 2)

感情迁移 提交于 2020-03-10 19:42:52
A - Two Regular Polygons 问是否可以在一个正多边形内部内接一个正多边形,可以内接,分配给内部的多边形的每一条边的角度一样,对应的外部多边形的边数一样 #include <bits/stdc++.h> using namespace std ; typedef long long LL ; typedef unsigned long long ULL ; int Gcd(int a,int b) { if ( b == 0 ) return a ; return Gcd ( b , a%b ) ; } int Lcm(int a, int b) { return a/ Gcd ( a,b ) *b ; } inline long long read() { long long f = 1, x = 0 ; char ch = getchar ( ) ; while (ch > '9' || ch < '0') { if ( ch == '-' ) f = -f ; ch = getchar ( ) ; } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0' ; ch = getchar ( ) ; } return x * f ; } const int maxn = 1e6 + 10 ; int

Educational Codeforces Round 83 (Rated for Div. 2) A - C

為{幸葍}努か 提交于 2020-03-10 11:45:12
A.Two Regular Polygons 题意:在一个凸的正多边形中,选择任意多顶点,能否再构造一个凸正多边形。 思路:水题,只要构造出来的正多边形的边数是原正多边形边数的因数即可。 Code: # include <bits/stdc++.h> using namespace std ; int main ( int argc , char * argv [ ] ) { int t ; int m , n ; cin >> t ; while ( t -- ) { scanf ( "%d%d" , & m , & n ) ; printf ( m % n == 0 ? "YES\n" : "NO\n" ) ; } return 0 ; } B - Bogosort 题意:输入一个数组 a [ 1 ] , a [ 2 ] . . . a [ n ] a[1],a[2]...a[n] a [ 1 ] , a [ 2 ] . . . a [ n ] ,做任意多次交换操作,使得对于任意 j < i ,恒有 j − a [ j ] ≠ i − a [ i ] j - a[j] ≠ i - a[i] j − a [ j ]  ​ = i − a [ i ] ,然后输出 思路:较为简单,因为对于 j j j 取值 1 − > n 1->n 1 − > n 的期间,j是单调递增的

Educational Codeforces Round 83 (Rated for Div. 2) C. Adding Powers(数学)

强颜欢笑 提交于 2020-03-10 03:04:28
Suppose you are performing the following algorithm. There is an array v 1 , v 2 , … , v n v1,v2,…,vn filled with zeroes at start. The following operation is applied to the array several times — at i i -th step ( 0 0 -indexed) you can: either choose position p o s pos ( 1 ≤ p o s ≤ n 1≤pos≤n ) and increase v p o s vpos by k i ki ; or not choose any position and skip this step. You can choose how the algorithm would behave on each step and when to stop it. The question is: can you make array v v equal to the given array a a ( v j = a j vj=aj for each j j ) after some step? Input The first line

Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals)

[亡魂溺海] 提交于 2020-03-06 06:21:30
这场据说很难,但是做起来感觉还好的 A. Restaurant Tables time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seater table. If there are none of them, it is seated at a vacant two-seater table. If there are none of them, it is seated at a two-seater table occupied by single person. If there are still none of them, the

Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)A B C 水 并查集 思路

倾然丶 夕夏残阳落幕 提交于 2020-03-06 06:21:19
A. Bear and Big Brother time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bear Limak wants to become the largest of bears, or at least to become larger than his brother Bob. Right now, Limak and Bob weigh a and b respectively. It's guaranteed that Limak's weight is smaller than or equal to his brother's weight. Limak eats a lot and his weight is tripled after every year, while Bob's weight is doubled after every year. After how many full years will Limak become strictly larger (strictly heavier) than Bob? Input The only line of the

Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) A B C D 暴力 水 二分 几何

懵懂的女人 提交于 2020-03-06 06:21:05
A. Vicious Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Tonio has a keyboard with only two letters, " V" and " K". One day, he has typed out a string s with only these two letters. He really likes it when the string " VK" appears, so he wishes to change at most one letter in the string (or do no changes) to maximize the number of occurrences of that string. Compute the maximum number of times " VK" can appear as a substring (i. e. a letter " K" right after a letter " V") in the resulting string. Input The first line will

Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)

一笑奈何 提交于 2020-03-06 06:20:48
A. Unimodal Array 题目链接: 点击 题意:给定一个数组 问这个数组是不是先严格上升然后恒定然后严格下降 根据样例可以推测 这三个过程是可以只存在部分过程 例如【1,2,2】【2,2,1】【1,2,1】【1,1,1】均为符合要求的。 瞎搞 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 int main() 6 { 7 int n; 8 cin>>n; 9 int a[123]; 10 for(int i=0;i<n;i++) 11 { 12 cin>>a[i]; 13 } 14 int ans = 0; 15 int cnt = 0; 16 for(int i=1;i<n;i++) 17 { 18 if(cnt == 1 &&a[i]>a[i-1]) 19 { 20 ans = 1; 21 break; 22 } 23 if(cnt == 2 &&a[i]>=a[i-1]) 24 { 25 ans = 1; 26 break; 27 } 28 if(cnt == 0 && a[i]==a[i-1]) 29 cnt = 1; 30 if(cnt != 2 && a[i]<a[i-1]) 31 cnt = 2; 32 } 33 if(ans) cout<<"NO"<<endl; 34 else cout<

Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) C. Jury Marks

一曲冷凌霜 提交于 2020-03-06 06:20:31
C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i -th jury member gave a i points. Polycarp does not remember how many points the participant had before this k marks were given, but he remembers that among the scores announced after each