Codeforces排位日记
hhhcbw
Hello World!!!
展开
-
Codeforces Round #687 (Div. 2, based on Technocup 2021 Elimination Round 2) A,B,C,D
文章目录A. Prison BreakB. Repainting StreetC. Bouncing BallD. XOR-gunA. Prison Break取该点和四个角的曼哈顿距离最大值即可。#include <bits/stdc++.h>using namespace std;int t;int main(){ cin>>t; while(t--) { int a,b,c,d; cin>>a&g原创 2020-12-01 14:51:25 · 284 阅读 · 0 评论 -
Codeforces Round #681 (Div. 2) A,B,C,D,E,F
文章目录A. Kids SeatingB. Saving the CityC. The Delivery DilemmaD. Extreme SubtractionA. Kids Seating是要整个序列不满足上述条件,一种方案就是从4*n开始,选4*n,4*n-2,4*n-4…选n个,我们发现最后一个被选的是2*n+2,其两倍比4*n大,可见这个方案必然是可行的。#include <bits/stdc++.h>using namespace std;int T;int n;in原创 2020-11-03 19:44:07 · 311 阅读 · 0 评论 -
Codeforces Round #680 (Div. 2)A,B,C,D
文章目录A. Array RearrangmentB. EliminationC. DivisionD. Divide and SumA. Array Rearrangment把两个数组从小到大排序,判断一下即可。#include <bits/stdc++.h>using namespace std;const int N=1e3+5;int T;int n,x;int a[N],b[N];int main(){ scanf("%d",&T); whi原创 2020-11-02 21:46:35 · 169 阅读 · 0 评论 -
Codeforces Round #678 (Div. 2) A,B,C,D,E
文章目录A. ReorderB. Prime SquareC. Binary SearchD. Bandit in a CityE. Complicated ComputationsA. Reorder判断一下所有元素加和是否等于m即可。#include <bits/stdc++.h>using namespace std;int T;int n,m;int sum;int main(){ scanf("%d",&T); while(T--) {原创 2020-10-30 17:05:08 · 952 阅读 · 2 评论 -
Codeforces Round #676(Div. 2) A,B,C,D
文章目录A. XORwiceB. Putting Bricks in the WallC. PalindromifierD. HexagonsA. XORwice要使值最小,我们要尽可能将1变成0,如果一个位上ai与bi不同,那么无论x这位取什么都没有影响,如果同为0,那么取0,如果同为1,取1。#include <iostream>#include <stdio.h>#include <cstring>#include <algorithm>u原创 2020-10-22 20:40:54 · 118 阅读 · 0 评论 -
Codeforces Round #675(Div. 2) A,B,C,D,E
文章目录A. FenceB. Nice MatrixC. BargainD. Returning HomeE. MinlexesA. Fence这题只要找最大值输出即可。#include <iostream>#include <stdio.h>#include <cstring>#include <algorithm>using namespace std;int T;int a,b,c;int main(){ scanf("%d原创 2020-10-09 12:38:38 · 183 阅读 · 0 评论 -
Codeforces Round #673(Div.2) A,B,C,D,E
文章目录A. Copy-pasteB. Two ArraysA. Copy-paste贪心即可,找一个最小的,尽可能的用其加到其他数上。#include <iostream>#include <stdio.h>#include <cstring>#include <algorithm>using namespace std;const int N=1e3+5;const int inf=0x3f3f3f3f;int T,n,k;int a原创 2020-09-29 20:50:41 · 148 阅读 · 2 评论 -
Codeforces Round #672(Div.2) A,B,C1,C2,D
文章目录A. Cubes SortingB. Rock and LeverC1. Pokémon Army (easy version)C2. Pokémon Army (hard version)D. Rescue Nibel!A. Cubes Sorting判断逆序数个数是否大于n*(n-1)/2,需要时间复杂度O(nlogn)。归并排序或者树状数组都可,这里是归并排序。#include <iostream>#include <stdio.h>using namespa原创 2020-09-25 21:14:05 · 112 阅读 · 1 评论 -
Codeforces Round #671(Div.2) A,B,C,D1,D2,E
文章目录A. Digit GameB. StairsC. KilljoyD1. Sage's Birthday (easy version)D2. Sage's Birthday (hard version)E. DecryptionA. Digit Game如果是偶数个,最后剩的数肯定在偶数位置,如果是奇数个,最后剩的数肯定在奇数位置。所以,如果是偶数个,只需要看,偶数位置有没有偶数即可,如果是奇数个,只需要看,奇数位置有没有奇数即可。#include <iostream>#inclu原创 2020-09-22 18:48:31 · 149 阅读 · 0 评论 -
Codeforces Round #670(Div. 2) A,B,C,D,E
文章目录A. Subset MexB. Maximum ProductC. Link Cut CentroidsD. Three SequencesE. Deleting NumbersA. Subset Mex桶排序,遇到没有的x,直接加上A,B剩下数量*x,遇到只剩一个的,如果A,B都还在,那么让一个结束,答案加上x,否则继续。#include <iostream>#include <stdio.h>#include <cstring>#include &原创 2020-09-17 20:46:43 · 108 阅读 · 0 评论 -
Codeforces Round #669(Div.2) A,B,C,D
文章目录A. AhahahahahahahahaB. Big VovaC. Chocolate BunnyD. Discrete Centrifugal JumpsA. Ahahahahahahahaha最多可以删n/2个,我们发现前3个删1个必定能使等于0,所以我们也可以推出前4个删2个必定能使等于0,这样最多删n/2个就能保证等于0。#include <iostream>#include <stdio.h>using namespace std;const int m原创 2020-09-10 15:55:08 · 108 阅读 · 0 评论 -
Codeforces Round #668(Div.2) A,B,C,D
文章目录A. Permutation ForgeryB. Array CancellationC. Balanced BitstringD. Tree TagA. Permutation Forgery因为只要排完序一样,所以逆序输出即可。#include <iostream>#include <stdio.h>using namespace std;int T,n;int a[105];int main(){ scanf("%d",&T);原创 2020-09-09 21:20:22 · 119 阅读 · 0 评论 -
Codeforces Round #666(Div.2) A,B,C,D
文章目录A. Juggling LettersB. Power SequenceC. Multiples of LengthD. Stoned GameA. Juggling Letters因为可以把任意一个串里的字符移到任意串的任意位置。所以如果能使所有串相等,只要对于字符数量%串数量=0即可。#include <iostream>#include <stdio.h>#include <cstring>#include <algorithm>u原创 2020-09-01 23:19:02 · 147 阅读 · 0 评论 -
Codeforces Round #665(Div.2) A,B,C,D
A Distance and Axis令OB=x,OA=nn<x,要满足x-(x-n)=k,即n=k,此时ans=k-n.n>x,要满足|x-(n-x)|=k,分两种情x况。x>n-x,此时2x-n=k,即x=(n+k)/2,首先n>=k,其次如果n和k奇偶性不同,还需要移动一次使其奇偶性相同。因此ans=max((n+k)%2,k-n)。x<n-x,此时n-2x=k,x=(n-k)/2,这里发现与上面满足的条件是一样的。#include <bits/stdc原创 2020-08-22 17:24:21 · 110 阅读 · 0 评论 -
Codeforces Round #664(Div.2) A,B,C,D
A Boboniu Likes to Color Balls分情况讨论一下即可。全为偶数,或者三个为偶数,是肯定可以的。只有两个为偶数是肯定不可以的。有一个为偶数,或者没有一个是偶数的情况,得看是否红,蓝,绿气球都有,如果都有则可以(可以转化成成立的情况),否则不可以。#include <iostream>#include <stdio.h>using namespace std;int T,r,g,b,w;int main(){ scanf("%d",&原创 2020-08-13 11:45:25 · 125 阅读 · 3 评论