QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#418719 | #5528. Least Annoying Constructive Problem | xlwang | WA | 0ms | 3668kb | C++14 | 1.5kb | 2024-05-23 15:21:11 | 2024-05-23 15:21:12 |
Judging History
answer
#include<bits/stdc++.h>
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
#define pii pair<int,int>
#define mk make_pair
using namespace std;
inline int read(){
int x=0;
bool f=0;
char c=getchar();
while(!isdigit(c)) f|=(c=='-'),c=getchar();
while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
return f?-x:x;
}
inline void write(int x){
if(x<0){putchar('-');x=-x;}
if(x>9)write(x/10);
putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline int randfind(int l,int r){return rnd()%(r-l+1)+l;}
//inline void init(){
// int t=read();
// while(t--) work();
//}
int n;
int tp;
inline void init(){
n=read();
}
inline void update(int &x){
if(x<=0) x+=n;
if(x>n) x-=n;
}
inline void work(){
if(n%2==0) --n,tp=1;
fr(i,1,n){
int l,r;
l=i;r=i+1;update(r);
while(l!=r){
writepl(min(l,r)),writeln(max(l,r));
--l,++r;update(l);update(r);
}
if(tp) writepl(i),writeln(n+1);
}
}
signed main(){
// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);
init();work();
// printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3520kb
input:
3
output:
1 2 2 3 1 3
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
4
output:
1 2 1 4 2 3 2 4 1 3 3 4
result:
ok Correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
5
output:
1 2 3 5 2 3 1 4 3 4 2 5 4 5 1 3 1 5 2 4
result:
ok Correct
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3668kb
input:
6
output:
1 2 3 5 1 6 2 3 1 4 2 6 3 4 2 5 3 6 4 5 1 3 4 6 1 5 2 4 5 6
result:
wrong answer Every consecutive n-1 edges have to form a tree, false for 2