codeforces题解
文章平均质量分 94
一枚菜鸡的codeforces写题记录
Auroraaaaaaaaaaaaa
我给世界唱歌
展开
-
Codeforces Round 868 (Div. 2) 题解
Consider an array a1,a2,…,anconsisting of numbers 1 and −1. Define A-characteristic of this array as a number of pairs of indices 1≤i<j≤n such that ai⋅aj=1Find any array a with given length n with A-characteristic equal to the given value k.InputEach test原创 2023-04-29 21:33:20 · 774 阅读 · 0 评论 -
Educational Codeforces Round 147 div2题解
D. Black Cells(模拟)You are playing with a really long strip consisting of1018 white cells, numbered from left to right as0,1,2and so on. You are controlling a special pointer that is initially in cell00. Also, you have a "Shift" button you can press原创 2023-04-21 02:26:03 · 1504 阅读 · 2 评论 -
Codeforces Round 866 (Div. 2) 题解
After holding one team contest, boy Yura got very tired and wanted to change his life and move to Japan. In honor of such a change, Yura changed his name to something nice.Fascinated by this idea he already thought up a name s consisting only of characters原创 2023-04-17 01:32:38 · 1220 阅读 · 4 评论 -
Codeforces Round 862 (Div. 2) 题解
There is an array a consisting of non-negative integers. You can choose an integer x and denote bi=ai⊕xfor all 1≤i≤n where ⊕⊕ denotes the bitwise XOR operation. Is it possible to choose such a number x that the value of the expression b1⊕b2⊕…⊕bnequals 0?It原创 2023-04-03 00:37:48 · 682 阅读 · 0 评论 -
Codeforces Round 860 Div. 2 题解
You are given two arrays a1,a2,…,anand b1,b2,…,bnIn one operation, you can choose any integer i from 11 to n and swap the numbers ai and bi.Determine whether, after using any (possibly zero) number of operations, the following two conditions can be satisfi原创 2023-03-27 02:09:25 · 697 阅读 · 0 评论 -
Codeforces Round 859 Div. 4题解
还是前缀和,如果c[i]小于等于前缀和,就合法,加进去,否则跳出。如果有两个相同字母 间隔奇数单位,一定不能形成01串,否则可以。贪心,先全部偶数给A,再奇数给B,比较大小。前缀和,然后各部分相加取模即可。原创 2023-03-20 01:21:07 · 1075 阅读 · 4 评论 -
Codeforces Round 858 (Div. 2)题解
You are given an array a of length n. The score of a is the MEX†† of [a1+a2,a2+a3,…,an−1+an]. Find the minimum score of a if you are allowed to rearrange elements of a in any order. Note that you are not required to construct the array a that achieves the原创 2023-03-18 22:46:40 · 895 阅读 · 11 评论 -
Codeforces Round 857 div.2
小明有两个朋友,进了n家商店,每家商店有价格为a[i],b[i] 的两个商品,小明要么给1号朋友买a[i],要么给2号朋友买b[i],怎么买能使给1号朋友和给2号朋友买的最贵的礼物差值最小每家商店都要买礼物,每个朋友至少有一个礼物输出:两个最贵的礼物的差值原创 2023-03-10 01:33:57 · 775 阅读 · 0 评论 -
Educational Codeforces Round 145 Div. 2 题解
否则先把所有都赋值为-2,从前往后第i个数可以构成n-i+1个子序列,如果这些子序列能全为正数则赋为正无穷大,否则赋为1+2*(k-1),k为剩下的正数个数。给你四个关闭的灯泡,每次打开或关闭一个,不能连续两次操作相同颜色的灯泡(数字相同为同色),问全部打开需要的最少次数。注意到实质为以(0,0)为圆心画正方形,顶点为(k,0),边长为 (k+1)*根号2 ,可以包含(k+1)^2个点。找规律,全部相同时,不能全部打开;构造一个长为n的序列,他的k个连续子序列和为正数,其他连续子序列和为负数。原创 2023-03-24 01:35:33 · 1145 阅读 · 2 评论 -
Nebius Welcome Round (div.1 + div.2)题解
注:病人可以看病的时间为[ ti , ti+w ],试剂盒可以用的时间为 [ x , x+d ] (x为拆开时间)移动规则:每秒可以向上、下、左、右、移动一步,或者保持不动,连续两秒不能往同一个方向移动。贪心直接算,先往离的远的地方走,然后两个方向交替行走,一边到达后,走一步停一步。有n个病人,每个人来医院的时间是ti,他们能等待的最长时间为w。每包试剂盒里有k个试剂,每盒试剂的有效期为d,到期后必须扔掉。国王从(0,0)点移动到(x,y)最少需要几秒。怎么安排病人看病,拆开的试剂盒最少。原创 2023-03-13 01:25:02 · 2156 阅读 · 0 评论