QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394515 | #7756. Omniscia Spares None | zhaohaikun | WA | 0ms | 3720kb | C++20 | 2.6kb | 2024-04-20 15:34:54 | 2024-04-20 15:34:54 |
Judging History
answer
// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "\033[33m[" << __LINE__ << "]\033[0m "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> T& chkmax(T& x, T y) {return x = max(x, y);}
template <typename T> T& chkmin(T& x, T y) {return x = min(x, y);}
template <typename T> T& read(T &x) {
x = 0; int f = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
return x *= f;
}
pair <int, int> p[10101];
vector <pair <int, int>> e;
signed main() {
int n;
cin >> n;
if (n <= 4) {
cout << "Yes\n";
F(i, 1, n) cout << 0 << ' ' << i << '\n';
cout << 0;
return 0;
}
if (n <= 6 || (n & 1)) {
cout << "No\n";
return 0;
}
cout << "Yes\n";
p[1] = make_pair(0, 1);
p[2] = make_pair(0, - 1);
p[3] = make_pair(- 1, 0);
p[4] = make_pair(1, 0);
p[5] = make_pair(0, 2);
p[6] = make_pair(0, - 2);
p[7] = make_pair(- 2, 0);
p[8] = make_pair(2, 0);
e.emplace_back(5, 7);
e.emplace_back(5, 3);
e.emplace_back(5, 1);
e.emplace_back(5, 4);
e.emplace_back(5, 8);
e.emplace_back(1, 3);
e.emplace_back(1, 4);
e.emplace_back(7, 3);
e.emplace_back(3, 4);
e.emplace_back(4, 8);
e.emplace_back(3, 2);
e.emplace_back(4, 2);
e.emplace_back(7, 6);
e.emplace_back(3, 6);
e.emplace_back(2, 6);
e.emplace_back(4, 6);
e.emplace_back(8, 6);
int c = 6;
while (c < n) {
if (c % 4 == 0) {
p[c + 1] = make_pair(0, c / 4 + 1);
p[c + 2] = make_pair(0, - (c / 4 + 1));
e.emplace_back(c + 1, c - 1);
e.emplace_back(c + 1, c);
e.emplace_back(c + 1, c - 3);
e.emplace_back(c + 2, c - 1);
e.emplace_back(c + 2, c);
e.emplace_back(c + 2, c - 2);
} else {
p[c + 1] = make_pair(- (c / 4 + 1), 0);
p[c + 2] = make_pair(c / 4 + 1, 0);
e.emplace_back(c + 1, c - 1);
e.emplace_back(c + 1, c);
e.emplace_back(c + 1, c - 3);
e.emplace_back(c + 2, c - 1);
e.emplace_back(c + 2, c);
e.emplace_back(c + 2, c - 2);
}
c += 2;
}
if (c % 4 == 0) {
p[c - 1].second = p[c].second = 1e9;
} else {
p[c - 1].first = p[c].first = 1e9;
}
e.emplace_back(c - 1, c);
F(i, 1, n) cout << p[i].first << ' ' << p[i].second << '\n';
cout << e.size() << '\n';
for (auto [a, b]: e) cout << a << ' ' << b << '\n';
return 0;
}
/* why?
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3664kb
input:
3
output:
Yes 0 1 0 2 0 3 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
4
output:
Yes 0 1 0 2 0 3 0 4 0
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1
output:
Yes 0 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
2
output:
Yes 0 1 0 2 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3672kb
input:
8
output:
Yes 0 1 0 -1 -1 0 1 0 0 2 0 -2 -2 1000000000 2 1000000000 24 5 7 5 3 5 1 5 4 5 8 1 3 1 4 7 3 3 4 4 8 3 2 4 2 7 6 3 6 2 6 4 6 8 6 7 5 7 6 7 3 8 5 8 6 8 4 7 8
result:
FAIL Duplicated Edge