链接: https://codeforces.com/contest/1185/problem/C2 题意: The only difference between easy and hard versions is constraints. If you write a solution in Python, then prefer to send it in PyPy to speed up execution time. A session has begun at Beland Stat…
因为不会打公式,随意就先将就一下? #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #include<vector> using namespace std; typedef long long LL; ; ; int add (int x,int y) {x=x+y;return x>=MOD?x-MOD:x;} int mul (int…
有点菜,只写出了三道.活不多说,上题开干. A. Ropewalkers Polycarp decided to relax on his weekend and visited to the performance of famous ropewalkers: Agafon, Boniface and Konrad. The rope is straight and infinite in both directions. At the beginning of the performance…
B. Email from Polycarp 题目链接:http://codeforces.com/contest/1185/problem/B 题目: Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it once may cause the corresponding symbol to appear more…
A. Ropewalkers 题目链接:http://codeforces.com/contest/1185/problem/A 题目: Polycarp decided to relax on his weekend and visited to the performance of famous ropewalkers: Agafon, Boniface and Konrad. The rope is straight and infinite in both directions. At…
链接: https://codeforces.com/contest/1185/problem/D 题意: A sequence a1,a2,-,ak is called an arithmetic progression if for each i from 1 to k elements satisfy the condition ai=a1+c⋅(i−1) for some fixed c. For example, these five sequences are arithmetic…
链接: https://codeforces.com/contest/1185/problem/B 题意: Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it once may cause the corresponding symbol to appear more than once (if you press…
链接: https://codeforces.com/contest/1185/problem/A 题意: Polycarp decided to relax on his weekend and visited to the performance of famous ropewalkers: Agafon, Boniface and Konrad. The rope is straight and infinite in both directions. At the beginning o…
这场和div3差不多嘛(后来发现就是div3),就是网太卡10min交一发就不错了,简直自闭. A 签到. B 记录每一段的字母数,满足条件即:段数相同+字母相同+字母数下>=上. #include<bits/stdc++.h> using namespace std; ; char a[N],b[N]; int n,m,n1,n2,c1[N],s1[N],c2[N],s2[N]; bool check() { ; n1=n2=; ;i<=n;i++)||a[i]!=a[i-])c…
从左往右扫,找到比第i个小的第一个数字,l[i] = l[last] + (i - last) * m[i],用单调栈O(n)维护这个过程,再从右往左扫,同理可以算出r数组,注意一下long long #include <bits/stdc++.h> using namespace std; ; int m[N], ans[N]; long long l[N], r[N]; stack < int > s; int main() { int n; scanf("%d&qu…
题意:给你两个长度为\(n\)的01串\(s\)和\(t\),可以选择\(s\)的前几位,取反然后反转,保证\(s\)总能通过不超过\(2n\)的操作得到\(t\),输出变换总数,和每次变换的位置. 题解:我们现将\(s\)串全部变成\(1\)或\(0\),确保\(s[n]=t[n]\),然后我们倒着遍历\(t\),若遇到相邻的两个字符不同,我们就对\(s\)中相应的位置执行一次操作,然后继续遍历,如下图: 代码: int t; int n; char s[N],tmp[N]; vector<i…
传送门:http://codeforces.com/contest/1108/problem/E2 E2. Array and Segments (Hard version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions i…
任意门:http://codeforces.com/contest/1118/problem/D1 D1. Coffee and Coursework (Easy version) time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions…
D1. RGB Substring (easy version) time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The only difference between easy and hard versions is the size of the input. You are given a string s consistin…
题目链接:Codeforces Round #298 (Div. 2) A. Exam An exam for n students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (i and i + 1) always studied side…