QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#84137#5528. Least Annoying Constructive ProblemIllusory_dimesWA 1ms3356kbC++141.4kb2023-03-05 19:22:542023-03-05 19:22:56

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-05 19:22:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3356kb
  • [2023-03-05 19:22:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define File(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout)
#define Check(a) freopen(a".in", "r", stdin), freopen(a".ans", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> pii;
#define mp make_pair
#define fi first
#define se second
#define eps 1e-10

const int mod = 1e9 + 7;
template <typename A>
inline int M(A x) {return x;}
template <typename A, typename ... B>
inline int M(A x, B ... args) {return 1ll * x * M(args ...) % mod;}

inline int Mi(const int &x) {return x >= mod ? x - mod : x;}
inline int Ad(const int &x) {return x < 0 ? x + mod : x;}
inline void mi(int &x, const int &y) {x += y; x >= mod && (x -= mod);}
inline void ad(int &x, const int &y) {x -= y; x < 0 && (x += mod);}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n, k, u, v; cin >> n;
	if (n & 1) { k = n >> 1;
		for (int i = 0; i < n; ++i) for (int j = 0; j < k; ++j) {
			u = (i + j + 1) % n + 1;
			v = (i - j + n) % n + 1;
			cout << u << " " << v << "\n";
		}
	}
	else { --n; k = n >> 1;
		for (int i = 0; i < n; ++i) for (int j = 0; j < k; ++j) {
			u = (i + j + 1) % n + 1;
			v = (i - j + n) % n + 1;
			cout << u << " " << v << "\n";
			if (j + 1 == k) cout << (i + k + 1) % n + 1 << " " << n + 1 << "\n";
		}
	}
	
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3356kb

input:

3

output:

2 1
3 2
1 3

result:

wrong answer Integer 1 violates the range [3, 3]