QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#933670 | #7756. Omniscia Spares None | Huangdu Technology Kindergarten (Naihui Jiang, Youwen Zhang, Siming Zhao) | WA | 1ms | 3712kb | C++23 | 3.3kb | 2025-03-13 23:50:47 | 2025-03-13 23:50:49 |
Judging History
answer
//
// ____ _ _ _ __ ____ ___ ____ _____
// | _ \ (_) __ _ _ __ __ _ | | ___ / | / /_ |___ \ ( _ ) | ___| |___ |
// | | | | | | / _` | | '_ \ / _` | | | / _ \ | | | '_ \ __) | / _ \ |___ \ / /
// | |_| | | | | (_| | | | | | | (_| | | | | __/ | | | (_) | / __/ | (_) | ___) | / /
// |____/ _/ | \__,_| |_| |_| \__, | |_| \___| |_| \___/ |_____| \___/ |____/ /_/
// |__/ |___/
//
// [题目链接] :
//
// [题目名称] :
//
// [ 做法 ] :
//
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'
#define all(x) (x).begin(), (x).end()
#define FINISH cout << "FINISH" << endl;
#define debug(x) cout << #x << " :== " << x << endl;
#define debugv(x)\
cout << #x << " :: ";\
for (auto v : x) cout << v << " ";\
cout << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
struct point {
int x, y;
};
void solve()
{
int n;
cin >> n;
if (n <= 4) {
cout << "Yes" << el;
for (int i = 1; i <= n ;i++) {
cout << i << " " << i << endl;
}
cout << "0" << el;
return;
}
if (n == 6 || n % 2 == 1) {
cout << "No" << el;
return;
}
vector<vector<int>> edge(n + 1);
vector<point> a(n + 1);
a[5] = {0, 0};
a[6] = {4, 4};
a[7] = {0, 4};
a[8] = {4, 0};
a[1] = {1, 1};
a[2] = {3, 3};
a[3] = {1, 3};
a[4] = {3, 1};
int cnt = 0;
edge[3].push_back(1);
edge[3].push_back(2);
edge[4].push_back(1);
edge[4].push_back(2);
edge[4].push_back(3);
edge[5].push_back(1);
edge[5].push_back(3);
edge[5].push_back(4);
edge[6].push_back(2);
edge[6].push_back(3);
edge[6].push_back(4);
edge[7].push_back(3);
edge[7].push_back(5);
edge[7].push_back(6);
edge[8].push_back(4);
edge[8].push_back(5);
edge[8].push_back(6);
int tmp = 2;
for (int i = 10; i <= n; i += 2) {
if (n % 4 == 2) {
tmp += 2;
a[i - 1] = {2 - tmp, 2 - tmp};
a[i] = {2 + tmp, 2 + tmp};
}
else {
a[i - 1] = {2 - tmp, 2 + tmp};
a[i] = {2 + tmp, 2 - tmp};
}
edge[i - 1].push_back(i - 5);
edge[i - 1].push_back(i - 3);
edge[i - 1].push_back(i - 2);
edge[i].push_back(i - 4);
edge[i].push_back(i - 3);
edge[i].push_back(i - 2);
}
edge[n - 2].push_back(n - 3);
if (n % 4 == 0) {
a[n - 2].y += 1000;
a[n - 3].x -= 1000;
}
else {
a[n - 2].y += 1000;
a[n - 3].x += 1000;
}
cout << "Yes" << el;
for (int i = 1; i <= n; i++) {
cout << a[i].x << " " << a[i].y << endl;
}
cout << 3 * n - 6 << endl;
for (int i= 1; i <= n; i++) {
for (auto to : edge[i]) {
cout << i << " " << to << endl;
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
// cin >> T;
while (T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
3
output:
Yes 1 1 2 2 3 3 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
4
output:
Yes 1 1 2 2 3 3 4 4 0
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
1
output:
Yes 1 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
2
output:
Yes 1 1 2 2 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
8
output:
Yes 1 1 3 3 1 3 3 1 -1000 0 4 1004 0 4 4 0 18 3 1 3 2 4 1 4 2 4 3 5 1 5 3 5 4 6 2 6 3 6 4 6 5 7 3 7 5 7 6 8 4 8 5 8 6
result:
ok OK, Accepted.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: -100
Wrong Answer
time: 1ms
memory: 3712kb
input:
10
output:
Yes 1 1 3 3 1 3 3 1 0 0 4 4 1000 4 4 1000 -2 -2 6 6 24 3 1 3 2 4 1 4 2 4 3 5 1 5 3 5 4 6 2 6 3 6 4 7 3 7 5 7 6 8 4 8 5 8 6 8 7 9 5 9 7 9 8 10 6 10 7 10 8
result:
wrong answer Invalid Planar Graph : segments (6, 2) and (7, 3) intersect