QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#84167 | #5528. Least Annoying Constructive Problem | sinsop90 | WA | 1ms | 3692kb | C++14 | 689b | 2023-03-05 20:43:22 | 2023-03-05 20:43:23 |
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(j == n / 2) cnt = 0, now ++, printf("%d %d\n", i + n / 2, n + 1);
}
}
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3520kb
input:
3
output:
1 2 2 3 1 3
result:
ok Correct
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3692kb
input:
4
output:
1 2 2 4 2 3 3 4 1 3 4 4
result:
wrong answer Integer 4 violates the range [5, 4]