QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394809 | #7756. Omniscia Spares None | linweitong | WA | 1ms | 5784kb | C++20 | 2.5kb | 2024-04-20 19:53:21 | 2024-04-20 19:53:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1000000;
int n;
int E[N][2],tot,mp[105][105],a[N],b[N],pd;
void add(int x,int y){
int m=(n/4);m*=4;
if (pd)m=n;
if (x<=0||y<=0||x>m||y>m)return;
if (mp[x][y])return;
mp[x][y]=mp[y][x]=1;
E[++tot][0]=x;E[tot][1]=y;
}
int main(){
cin>>n;
if (n==1)return cout<<"Yes\n1 1\n0",0;
if (n==2)return cout<<"Yes\n1 1\n2 1\n0",0;
if (n==3)return cout<<"Yes\n1 1\n2 1\n2 2\n0",0;
if (n==4)return cout<<"Yes\n1 1\n2 1\n2 2\n1 2\n0",0;
if ((n>=5&&n<=7)||(n&1))return cout<<"No",0;
cout<<"Yes\n";
if (n%4==0){
cout<<"1000000000 100000000\n";
int t=300;
for (int i=1;i<=n;i+=4){
a[i]=0;
b[i]=t;
t--;
add(i,i+1);
add(i,i+5);
add(i,i+4);
add(i,i+7);
add(i,i+3);
add(i,i-4);
}
t=300;
for (int i=2;i<=n;i+=4){
a[i]=-t*10000;
b[i]=0;
t--;
add(i,i-4);
add(i,i-5);
add(i,i-1);
add(i,i+4);
add(i,i+1);
add(i,i-3);
}
t=300;
for (int i=3;i<=n;i+=4){
a[i]=0;
b[i]=-t*10000;
t--;
add(i,i-4);
add(i,i-1);
add(i,i+3);
add(i,i+5);
add(i,i+1);
add(i,i+4);
}
t=300;
for (int i=4;i<=n;i+=4){
a[i]=t*10000;
b[i]=0;
t--;
add(i,i-3);
add(i,i+4);
add(i,i-1);
add(i,i-7);
add(i,i-5);
add(i,i-4);
}
add(n,n-2);
add(1,3);
for (int i=2;i<=n;++i)cout<<a[i]<<" "<<b[i]<<"\n";
cout<<tot<<"\n";
for (int i=1;i<=tot;++i)cout<<E[i][0]<<" "<<E[i][1]<<"\n";
}
else{
cout<<"-100000000 -1000000000\n";
int t=300;
for (int i=1;i<=n-2;i+=4){
a[i]=-t*10000;
b[i]=0;
t--;
add(i,i-1);
add(i,i+3);
add(i,i+4);
add(i,i+1);
add(i,i-3);
add(i,i-4);
}
t=300;
for (int i=2;i<=n-2;i+=4){
a[i]=0;
b[i]=-t*10000;
t--;
add(i,i-4);
add(i,i-1);
add(i,i+3);
add(i,i+5);
add(i,i+1);
add(i,i+4);
}
t=300;
for (int i=3;i<=n-2;i+=4){
a[i]=t*10000;
b[i]=0;
t--;
add(i,i-4);
add(i,i+4);
add(i,i-3);
add(i,i+1);
add(i,i-1);
add(i,i-5);
}
t=300;
for (int i=4;i<=n-2;i+=4){
a[i]=0;
b[i]=t*10000;
t--;
add(i,i-4);
add(i,i+4);
add(i,i-3);
add(i,i+1);
add(i,i-1);
add(i,i+3);
}
pd=1;
add(4,n-1);
add(1,n-1);
add(3,n-1);
a[n-1]=0;
b[n-1]=301*10000;
add(1,n);
add(2,n);
add(3,n);
a[n]=0;
b[n]=-301*10000;
add(n-5,n-3);
add(1,3);
for (int i=2;i<=n;++i)cout<<a[i]<<" "<<b[i]<<"\n";
cout<<tot<<"\n";
for (int i=1;i<=tot;++i)cout<<E[i][0]<<" "<<E[i][1]<<"\n";
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3692kb
input:
3
output:
Yes 1 1 2 1 2 2 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
4
output:
Yes 1 1 2 1 2 2 1 2 0
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1
output:
Yes 1 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2
output:
Yes 1 1 2 1 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 1ms
memory: 5784kb
input:
8
output:
Yes 1000000000 100000000 -3000000 0 0 -3000000 3000000 0 0 299 -2990000 0 0 -2990000 2990000 0 18 1 2 1 6 1 5 1 8 1 4 5 6 5 8 2 6 2 3 6 7 6 3 3 8 3 4 3 7 7 8 4 8 8 6 1 3
result:
ok OK, Accepted.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: -100
Wrong Answer
time: 1ms
memory: 5756kb
input:
10
output:
Yes -100000000 -1000000000 0 -3000000 3000000 0 0 3000000 -2990000 0 0 -2990000 2990000 0 0 2990000 0 3010000 0 -3010000 24 1 4 1 5 1 2 5 4 5 8 5 6 5 2 2 7 2 3 2 6 6 7 3 7 3 4 7 4 7 8 4 8 4 9 1 9 3 9 1 10 2 10 3 10 5 7 1 3
result:
wrong answer Invalid Planar Graph : segments (1, 4) and (5, 8) intersect