QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#84137 | #5528. Least Annoying Constructive Problem | Illusory_dimes | WA | 1ms | 3356kb | C++14 | 1.4kb | 2023-03-05 19:22:54 | 2023-03-05 19:22:56 |
Judging History
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]