QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#344581 | #5528. Least Annoying Constructive Problem | Meatherm | WA | 1ms | 3828kb | C++14 | 871b | 2024-03-04 20:04:25 | 2024-03-04 20:04:25 |
Judging History
answer
# include <bits/stdc++.h>
const int N=510,INF=0x3f3f3f3f;
inline int read(void){
int res,f=1;
char c;
while((c=getchar())<'0'||c>'9')
if(c=='-') f=-1;
res=c-48;
while((c=getchar())>='0'&&c<='9')
res=res*10+c-48;
return res*f;
}
int n;
inline int conclo(int x){
return (x==1)?n:(x-1);
}
inline int clo(int x){
return (x==n)?1:(x+1);
}
inline void solve_odd(void){
for(int i=1;i<=n;++i){
int l=conclo(i),r=clo(i);
for(int j=1;j<=n/2;++j) printf("%d %d\n",l,r),l=conclo(l),r=clo(r);
}
return;
}
inline void solve_even(void){
--n;
for(int i=1;i<=n;++i){
printf("%d %d\n",i,n+1);
int l=conclo(i),r=clo(i);
for(int j=1;j<=n/2;++j) printf("%d %d\n",l,r),l=conclo(l),r=clo(r);
}
return;
}
int main(void){
n=read();
if(n%2) solve_odd();
else solve_even();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3828kb
input:
3
output:
3 2 1 3 2 1
result:
wrong answer Integer 2 violates the range [4, 3]