QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#326772 | #7756. Omniscia Spares None | Delay_for_five_minutes | WA | 0ms | 3852kb | C++20 | 1.9kb | 2024-02-14 00:13:42 | 2024-02-14 00:13:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int x[105] , y[105];
int cnt = 0;
void addp(int a,int b) {
x[++cnt] = a;
y[cnt] = b;
return ;
}
typedef pair<int,int> pii;
vector<pii> Ed;
void adde(int u,int v) {
Ed.push_back({u , v});
}
int main() {
int n ; cin >> n;
if(n <= 4) {
printf("Yes\n");
for(int i = 1;i <= n;i++) printf("0 %d\n",i) ;
printf("0\n") ; return 0;
}
if((n & 1) || n == 6) {
printf("No\n") ; return 0;
}
addp(0 , 1);
addp(0 , -1);
addp(1 , 0);
addp(-1 , 0);
addp(0 , 2);
addp(0 , -2) ;
adde(1 , 3) ; adde(1 , 4) ; adde(1 , 5) ; adde(2 , 3) ; adde(2 , 4) ; adde(2 , 6);
adde(3 , 4) ;
adde(3 , 5) ; adde(4 , 5) ; adde(3 , 6) ; adde(4 , 6) ;
int x_range = 1 , y_range = 2;
int cur = 0 ; ///0 , add to x , 1 , add to y
for(int i = 8;i <= n;i += 2) {
if(cur == 0) {
++x_range;
addp(x_range , 0);
addp(-x_range , 0);
}
else {
++y_range;
addp(0 , y_range);
addp(0 , -y_range);
}
adde(i - 1 , i - 2);
adde(i - 1 , i - 3);
adde(i , i - 2);
adde(i , i - 3);
adde(i , i - 4);
adde(i - 1 , i - 5);
cur ^= 1;
}
adde(n - 2 , n - 3) ;
///cur = 0 时,y为轴;cur = 1时 x为轴
for(int i = 1;i <= cnt;i++) x[i] *= 2 , y[i] *= 2;
for(int i = 1;i <= cnt;i++) {
if(cur == 0 && x[i] != 0) {
y[i] += (y_range + 1 + abs(x[i]/2) - x_range)*2 - 1;
}
if(cur == 1 && y[i] != 0) {
x[i] += (x_range + 1 + abs(y[i]/2) - y_range)*2 - 1;
}
}
printf("Yes\n") ;
for(int i = 1;i <= cnt;i++) printf("%d %d\n",x[i],y[i]) ;
printf("%d\n",Ed.size()) ;
for(auto [u,v] : Ed) printf("%d %d\n",u,v);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3788kb
input:
3
output:
Yes 0 1 0 2 0 3 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3740kb
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: 3852kb
input:
1
output:
Yes 0 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
2
output:
Yes 0 1 0 2 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
8
output:
Yes 3 2 3 -2 2 0 -2 0 5 4 5 -4 4 0 -4 0 18 1 3 1 4 1 5 2 3 2 4 2 6 3 4 3 5 4 5 3 6 4 6 7 6 7 5 8 6 8 5 8 4 7 3 6 5
result:
ok OK, Accepted.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3736kb
input:
10
output:
Yes 0 2 0 -2 2 5 -2 5 0 4 0 -4 4 7 -4 7 0 6 0 -6 24 1 3 1 4 1 5 2 3 2 4 2 6 3 4 3 5 4 5 3 6 4 6 7 6 7 5 8 6 8 5 8 4 7 3 9 8 9 7 10 8 10 7 10 6 9 5 8 7
result:
wrong answer Invalid Planar Graph : segments (3, 4) and (7, 5) intersect