QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394569 | #7756. Omniscia Spares None | le0n | WA | 1ms | 3956kb | C++14 | 1.3kb | 2024-04-20 16:17:10 | 2024-04-20 16:17:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
vector< pair<int, int> > E;
pair<int, int> pos[100005];
int main()
{
int n, i;
scanf("%d", &n);
if(n <= 4)
{
printf("Yes\n");
for(i = 1; i <= n; i++)
printf("0 %d\n", i);
printf("0\n");
return 0;
}
if(n == 6 || (n & 1))
{
printf("No\n");
return 0;
}
for(i = 1; i <= n - 4; i++)
E.emplace_back(make_pair(i, i + 4));
E.emplace_back(make_pair(3, 4));
for(i = 1; i <= n - 2; i += 2)
{
E.emplace_back(make_pair(i, i + 2));
E.emplace_back(make_pair(i + 1, i + 2));
E.emplace_back(make_pair(i, i + 3));
E.emplace_back(make_pair(i + 1, i + 3));
}
E.emplace_back(make_pair(n - 3, n - 2));
for(i = 1; i <= n; i += 2)
{
if(i == n - 3)
continue;
if((i / 2) & 1)
{
pos[i] = make_pair(i / 2, 0);
pos[i + 1] = make_pair(-(i / 2), 0);
}
else
{
pos[i] = make_pair(0, i / 2 + 1);
pos[i + 1] = make_pair(0, -(i / 2 + 1));
}
}
if((n / 2) & 1)
{
pos[n - 3] = make_pair(1e9, n);
pos[n - 2] = make_pair(-1e9, n);
}
else
{
pos[n - 3] = make_pair(n, 1e9);
pos[n - 2] = make_pair(-n, 1e9);
}
printf("Yes\n");
for(i = 1; i <= n; i++)
printf("%d %d\n", pos[i].first, pos[i].second);
printf("%d\n", E.size());
for(i = 0; i < E.size(); i++)
printf("%d %d\n", E[i].first, E[i].second);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3892kb
input:
3
output:
Yes 0 1 0 2 0 3 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3828kb
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: 3888kb
input:
1
output:
Yes 0 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
2
output:
Yes 0 1 0 2 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3956kb
input:
8
output:
Yes 0 1 0 -1 1 0 -1 0 8 1000000000 -8 1000000000 3 0 -3 0 18 1 5 2 6 3 7 4 8 3 4 1 3 2 3 1 4 2 4 3 5 4 5 3 6 4 6 5 7 6 7 5 8 6 8 5 6
result:
wrong answer Invalid Planar Graph : segments (1, 5) and (3, 6) intersect