http://codeforces.com/contest/1203/problem/F1 Examples input 1 - - output 1 YES input 2 - - output 2 YES input 3 - - output 3 YES input 4 - output 4 NO Note In the first example, the possible order is: 1,2,3. In the second example, the possible order…
D. Minimization time limit per test  2 seconds memory limit per test  256 megabytes input  standard input  output  standard output You've got array A, consisting of n integers and a positive integer k. Array A is indexed by integers from 1 to n. You…
Codeforces Round #579 (Div. 3) 传送门 A. Circle of Students 这题我是直接把正序.逆序的两种放在数组里面直接判断. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 205; int q, n; int a[N], b[N], c[N]; int main() { ios::sync_with_stdio(false);…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
A. Circle of Students      题目:https://codeforces.com/contest/1203/problem/A 题意:一堆人坐成一个环,问能否按逆时针或者顺时针正好是 1-n的顺序 思路:水题,把数组开两倍,或者标记当前位置都可以 #include<bits/stdc++.h> #define maxn 100005 #define mod 1000000007 using namespace std; typedef long long ll; int…
思考之后再看题解,是与别人灵魂之间的沟通与碰撞 A. Circle of Students 题意 给出n个数,问它们向左或者向右是否都能成一个环.比如样例5是从1开始向左绕了一圈 [3, 2, 1, 5, 4] 变成 [1, 2, 3, 4, 5]; 思路 我的方法是差分,假如成立,相邻两个数的差的绝对值要么是1要么是n-1. #include<iostream> #include<cstdio> #include<algorithm> #include<cmat…
比赛链接:https://codeforc.es/contest/1203/ A. Circle of Students 题意:\(T\)组询问,每组询问给出\(n\)个数字,问这\(n\)个数字能否围成圆环.(围成圆环指,从某一位开始顺时针或逆时针遍历,数组为\(1, 2, 3, ..., n\)) 分析:把数组复制一份,两个数组首尾相接,正反判定两次即可. AC代码: #include<bits/stdc++.h> #define SIZE 200010 #define rep(i, a,…
题目链接:https://codeforces.com/contest/1203/problem/D2 题意: 给你S串.T串,问你最长删除多长的子串使得S串里仍然有T的子序列. 思路: 想了好久,先正着跑一下S串,记录T串每一个字符最左边在哪里,再倒着跑一下,记录T串的每一个字符最右边在哪里. 最后跑一下答案: 1. 开头和结尾特判一下,但不是max( L[1]-1 , l1-R[l2] ) , 而是对两个max( L[1]-1 , l1-L[l2]-1 ).max( R[1]-1 , l1-…
#include<bits/stdc++.h>using namespace std;char s[200007],t[200007];int last[200007][27],nxt[200007][27];int l[200007],r[200007];int main(){ cin>>s+1>>t+1; int n=strlen(s+1); int m=strlen(t+1); for(int i=1;i<=n;++i){ for(int j=0;j<…
B Equal Rectangles 题意: 给你4*n个数,让你判断能不能用这个4*n个数为边凑成n个矩形,使的每个矩形面积相等 题解: 原本是想着用二分来找出来那个最终的面积,但是仔细想一想,那个面积只能是给出的4*n个数中的最小值和最大值的乘积,如果这两个长度不凑成一个矩形,那么肯定全部矩形的面积会出现不一致的 代码: 1 //The idea was to use dichotomies to find that area, and then use that area to figur…