QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#423021#5528. Least Annoying Constructive ProblemBallmer Peak (Ali Safari, AmirMohammad Shahrezaei, Alireza Keshavarz)#WA 0ms3708kbC++23690b2024-05-27 20:50:382024-05-27 20:50:39

Judging History

This is the latest submission verdict.

  • [2024-05-27 20:50:39]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3708kb
  • [2024-05-27 20:50:38]
  • Submitted

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