QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#84165 | #5528. Least Annoying Constructive Problem | sinsop90 | WA | 2ms | 3696kb | C++14 | 684b | 2023-03-05 20:39:29 | 2023-03-05 20:39:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n;
int rev(int x) {
if(x <= 0) return x + n;
if(x > n) return x - n;
return x;
}
int main() {
scanf("%d", &n);
if(n & 1) {
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= n / 2;j++) {
int u = rev(i - j + 1), v = rev(i + j);
if(u > v) swap(u, v);
printf("%d %d\n", u, v);
}
}
}
else {
int cnt = 0, now = 0;
n --;
for(int i = 1;i <= n;i++) {
for(int j = 1;j <= n / 2;j++) {
int u = rev(i - j + 1), v = rev(i + j);
cnt ++;
if(u > v) swap(u, v);
printf("%d %d\n", u, v);
if(cnt == n - 1) cnt = 0, now ++, printf("%d %d\n", now, n + 1);
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
3
output:
1 2 2 3 1 3
result:
ok Correct
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3692kb
input:
4
output:
1 2 2 3 1 4 1 3
result:
wrong output format Unexpected end of file - int32 expected