QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#423021 | #5528. Least Annoying Constructive Problem | Ballmer Peak (Ali Safari, AmirMohammad Shahrezaei, Alireza Keshavarz)# | WA | 0ms | 3708kb | C++23 | 690b | 2024-05-27 20:50:38 | 2024-05-27 20:50:39 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef array<int, 4> ai;
const int maxn = 1e7 + 10;
const int mod = 998244353;
int n;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n;
if(n & 1){
rep(i, 0, n){
rep(j, 0, n){
int k = ((i - (j - i)) % n + n) % n;
if(j < k){
cout << j + 1 << " " << k + 1 << "\n";
}
}
}
}
else{
n--;
rep(i, 0, n){
cout << i + 1 << " " << n + 1 << "\n";
rep(j, 0, n){
int k = ((i - (j - i)) % n + n) % n;
if(j < k){
cout << j + 1 << " " << k + 1 << "\n";
}
}
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3708kb
input:
3
output:
2 3 1 3 1 2
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
4
output:
1 4 2 3 2 4 1 3 3 4 1 2
result:
ok Correct
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
5
output:
2 5 3 4 1 3 4 5 1 5 2 4 1 2 3 5 1 4 2 3
result:
wrong answer Every consecutive n-1 edges have to form a tree, false for 1