https://atcoder.jp/contests/agc031/tasks/agc031_b B - Reversi Time Limit: 2 sec / Memory Limit: 1024 MB Problem Statement There are N stones arranged in a row. The i-th stone from the left is painted in the color Ci. Snuke will perform the following…
那天晚上由于毕业晚会与同学吃饭喝酒没打 AGC,第二天稍微补了下题,目前补到了 E,显然 AGC 的 F 对于我来说都是不可做题就没补了(bushi A 简单题,不难发现如果我们通过三次及以上的操作将这个串消完,那么我们完全可以把它压缩到两次以内,因此如果两段字符不同答案就是 \(1\),否则我们枚举分割点然后判断分割点两段是否都可以一次消完,如果存在这样的分割点答案就是 \(2\),否则答案为 \(-1\). B 注意到如果我们将原序列分成和相等的两部分并两部分将它们排成一列,那么有且只有一种…
传送门 \(A\) 找到能达到的最大的和最小的,那么中间任意一个都可以被表示出来 typedef long long ll; int n,a,b;ll res; int main(){ scanf("%d%d%d",&n,&a,&b); if(a>b||n==1&&a!=b)return puts("0"),0; res=(a+b+1ll*(n-2)*b)-(a+b+1ll*(n-2)*a)+1; printf(&quo…
传送门 \(A\) 直接按时间排序之后贪心就可以了 const int N=1e5+5; int a[N],q[N],c,k,h,t,n,res; inline int min(R int x,R int y){return x<y?x:y;} int main(){ scanf("%d%d%d",&n,&c,&k); fp(i,1,n)scanf("%d",&a[i]); sort(a+1,a+1+n); h=1,t=0; f…
传送门 \(A\) 分类讨论就行了 然而我竟然有一种讨论不动的感觉 int x,y; inline int min(R int x,R int y){return x<y?x:y;} inline int min(R int a,R int b,R int c,R int d){ return min(min(a,b),min(c,d)); } inline int calc(R int x,R int y){return y>=x?y-x:x-y+2;} int main(){ scanf(…
A - A+...+B Problem 常识 Problem Statement Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? 用\(n\)个在\([A,B]\)之间的数加和能够组合出来的不同的数的个数. C…
A - Cookie Exchanges 模拟 Problem Statement Takahashi, Aoki and Snuke love cookies. They have A, B and C cookies, respectively. Now, they will exchange those cookies by repeating the action below: Each person simultaneously divides his cookies in half…
好久没更了 写点东西吧= = A 01Matrix 简单构造 左上角和右下角染成1其他染成0即可 #include<bits/stdc++.h> #define ll long long using namespace std; int a[1010][1010]; int main(){ int n,m,A,B; cin>>n>>m>>A>>B; if(A*2>m||B*2>n)return puts("-1")…