d2[maxn][maxn];voidsolve(){scanf("%d%d%d",&n,&m,&k);intres=n-1+m-1;if(res>k||((k-res)&1)){printf("NO\n");return;}printf("YES\n");chars[2]={'R','B'};intcur=0;// 构造基础路径for(inti=0;i<n;++i){for(intj=1;j<m;++j){d1[i][j]=(j&1)?cur:1-cur;...
Codeforces Round 910 (Div. 2) 错过比赛了,不过算是补上了orz A - Milica and String 给一个只有 、A、B 组成的字符串,每次可以把开头 i 个字符变成 或A或B 问需要几次操作才能让串中恰好有 k 个B 不难证明(?)至多一次操作就能符合题意 B 多加B, B 多加A ,统计 B 的数量,再操作即可 #incl...
Codeforces Round 901 (Div. 2) (A~D) 关注 昨晚被div1狠狠地背刺了,AB居然不是div2的CD,甚至还卡了巨简单的博弈掉了大分,今天vp了一下div2发现(A~D)是真挺简单,奈何不让紫名参赛qwq。A.Jellyfish and Undertale显然对于每一个工具,根据贪心的思想,我们都可以在炸弹还剩最后一秒的时候使用它,于是答案即...
x1=y1; x2=y2; }elsex1++; }if(x2==m+1)cout<<re<<endl;elsecout<<-1<<endl;return0; } win(1)+win(2)+⋯+win(n)n
Codeforces Round 915 (Div. 2) (A~E) qfl_zzz 编辑于 2023年12月18日 08:17 题解写得有点晚了,今天白天有点摸鱼,果咩qwqA.Constructive Problems显然斜着放是最优的,这样的话每一行每一列都至少需要有一个,答案即是 。 B.Begginer's Zelda显然我们每一次肯定是选择两个叶子节点来进行操作是最优的,...
Codeforces Round 906 (Div. 2) A. Doremy's Paint 3 解题思路: \(a_1 + a_2 = a_2 + a_3\),所以\(a_1 = a_3\)。以此类推。所以整个序列最多出现两种不同的数字。 \(n = 2\)时,必然存在。 \(n = 3
Codeforces Round #442 (Div. 2) 题解 题目链接:http://codeforces.com/contest/877A. Alex and broken contest题意:问 给定的串是否恰好只能匹配一个题上给出的人名。解法:暴力匹配即可。#include <bits/stdc++.h>using namespace std;string a[5]={"Danil","Olya","Slava","Ann","Nikita i++ 数位...
Codeforces Round 976 (Div. 2) and Divide By Zero 9.0 A. Find Minimum Operations https://codeforces.com/contest/2020/problem/A这里timeout两次。1.二分定位2.得到的这个数还需要做个除法,代表减去它几次。在这里很容易超时。n=1e9和k=9999 9999 9 的时候出问题。/**/#include <bits/stdc++.h>#...
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her ment...
codeforces round950 div3 这场属于是模拟大合集了(对我来说),不过模拟的码量是真的多啊 可惜网卡没打 A 求比赛要加的题数,一开始看错题了,以为每场并不是都是相同题数,结果一看都是到G题 很简单,模拟一遍就行 #include<bits/stdc++.h>usingnamespacestd;intt;voidsolve(){intn,m;string a;intc[...