QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394529 | #7756. Omniscia Spares None | zhaohaikun | WA | 1ms | 3712kb | C++20 | 2.6kb | 2024-04-20 15:44:58 | 2024-04-20 15:44:59 |
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[4] = make_pair(0, 1);
p[3] = make_pair(0, - 1);
p[1] = make_pair(- 1, 0);
p[2] = make_pair(1, 0);
p[8] = make_pair(0, 2);
p[7] = make_pair(0, - 2);
p[5] = make_pair(- 2, 0);
p[6] = make_pair(2, 0);
e.emplace_back(1, 2);
e.emplace_back(1, 3);
e.emplace_back(1, 4);
e.emplace_back(1, 5);
e.emplace_back(1, 7);
e.emplace_back(1, 8);
e.emplace_back(2, 3);
e.emplace_back(2, 4);
e.emplace_back(2, 6);
e.emplace_back(2, 7);
e.emplace_back(2, 8);
e.emplace_back(3, 7);
e.emplace_back(4, 7);
e.emplace_back(4, 8);
e.emplace_back(5, 7);
e.emplace_back(5, 8);
e.emplace_back(6, 7);
e.emplace_back(6, 8);
int c = 8;
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].first = p[c].first = 1e9;
} else {
p[c - 1].second = p[c].second = 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: 1ms
memory: 3568kb
input:
3
output:
Yes 0 1 0 2 0 3 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3652kb
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: 3636kb
input:
1
output:
Yes 0 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2
output:
Yes 0 1 0 2 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
8
output:
Yes -1 0 1 0 0 -1 0 1 -2 0 2 0 1000000000 -2 1000000000 2 19 1 2 1 3 1 4 1 5 1 7 1 8 2 3 2 4 2 6 2 7 2 8 3 7 4 7 4 8 5 7 5 8 6 7 6 8 7 8
result:
wrong answer Invalid Planar Graph : segments (1, 3) and (5, 7) intersect