构造
invoKer-
这个作者很懒,什么都没留下…
展开
-
CodeForces - 27C Unordered Subsequence【水题】【构造】
题目链接:https://codeforces.com/contest/27/problem/C#include <iostream>using namespace std;static const int MAXN=1e5+10;int n;int a[MAXN];int main(){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); if(n>=原创 2020-11-09 18:21:00 · 106 阅读 · 0 评论 -
CodeForces - 26C Parquet【构造】
题目链接:https://codeforces.com/contest/26/problem/C#include <iostream>#include <cctype>using namespace std;static const int MAXN=100+10;char g[MAXN][MAXN];int n,m,a,b,c;int main(){ scanf("%d%d%d%d%d",&n,&m,&a,&b,&c)原创 2020-11-07 22:00:04 · 182 阅读 · 0 评论 -
CodeForces - 23C Oranges and Apples【构造】
题目链接:https://codeforces.com/contest/23/problem/C奇妙的构造,不过2500似乎是有点高了#include <iostream>#include <algorithm>using namespace std;static const int MAXN=1e5+10;inline int read(){ int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(c原创 2020-10-29 17:46:47 · 85 阅读 · 0 评论 -
CodeForces - 23B Party【构造】
题目链接:https://codeforces.com/contest/23/problem/B这个题的构造可真是太妙了 orz#include <iostream>using namespace std;int main(){ int T,n; scanf("%d",&T); while(T--) { scanf("%d",&n); printf("%d\n",n>2?n-2:0); }原创 2020-10-29 17:44:43 · 112 阅读 · 0 评论 -
CodeForces - 22C System Administrator【构造】
题目链接:https://codeforces.com/contest/22/problem/C#include <iostream>using namespace std;int n,m,v;int main(){ scanf("%d%d%d",&n,&m,&v); if(m<n-1 || m>n-1+1ll*(n-2)*(n-3)/2) puts("-1"); else { for(int i=1;原创 2020-10-28 19:14:01 · 161 阅读 · 0 评论 -
CodeForces - 12E Start of the season【构造】
题目链接:https://codeforces.com/contest/12/problem/E先构造1~n-1的每行每列不存在重复数字的矩阵以n=6为例1 2 3 4 52 3 4 5 13 4 5 1 24 5 1 2 35 1 2 3 4对角线的数字1,3,5,2,4…显然满足 (i+2)%n 不会重复故把对角线中的数字移到最后一列,并把对角线置00 2 3 4 5 12 0 4 5 1 33 4 0 1 2 54 5 1 0 3 25 1 2 3 0 4再把最后一行抄上原创 2020-09-23 10:29:04 · 166 阅读 · 1 评论