QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394857#7756. Omniscia Spares NonelinweitongWA 1ms5660kbC++202.6kb2024-04-20 20:46:192024-04-20 20:46:21

Judging History

你现在查看的是最新测评结果

  • [2024-04-20 20:46:21]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5660kb
  • [2024-04-20 20:46:19]
  • 提交

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<<"100000000 1000000000\n";
		cout<<"100000000 -1000000000\n";
		int t=300;
		for (int i=1;i<=n;i+=4){
			a[i]=0;
			b[i]=t*10000;
			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=3;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";
		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=3;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";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3680kb

input:

3

output:

Yes
1 1
2 1
2 2
0

result:

ok OK, Accepted.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3736kb

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: 3676kb

input:

1

output:

Yes
1 1
0

result:

ok OK, Accepted.

Test #4:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

2

output:

Yes
1 1
2 1
0

result:

ok OK, Accepted.

Test #5:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

6

output:

No

result:

ok OK, Accepted.

Test #7:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

7

output:

No

result:

ok OK, Accepted.

Test #8:

score: -100
Wrong Answer
time: 1ms
memory: 5660kb

input:

8

output:

Yes
100000000 1000000000
100000000 -1000000000
0 -3000000
3000000 0
0 2990000
-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:

wrong answer Invalid Planar Graph : segments (5, 8) and (1, 3) intersect