QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394491#7756. Omniscia Spares NoneOccDreamerWA 0ms3740kbC++142.4kb2024-04-20 15:16:252024-04-20 15:16:25

Judging History

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

  • [2024-04-20 15:16:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-04-20 15:16:25]
  • 提交

answer

//OccDreamer
#include<bits/stdc++.h>

#define vc vector
#define db double
#define fi first
#define se second
#define ll long long
#define mk make_pair
#define pb push_back
#define RI register int
#define PI pair<int,int>
#define ull unsigned long long
#define err cerr << "   -_-   " << endl
#define debug cerr << " ------------------- " << endl

#define input(x) freopen(#x".in","r",stdin)
#define output(x) freopen(#x".out","w",stdout)

#define NO puts("No")
#define YES puts("Yes")

//#define OccDreamer
//#define int long long

using namespace std;

namespace IO{
	inline int read(){
		int X=0, W=0; char ch=getchar();
		while(!isdigit(ch)) W|=ch=='-', ch=getchar();
		while(isdigit(ch)) X=(X<<1)+(X<<3)+(ch^48), ch=getchar();
		return W?-X:X;
	}
	inline void write(int x){
		if(x<0) x=-x, putchar('-');
		if(x>9) write(x/10);
		putchar(x%10+'0');
	}
	inline void sprint(int x){write(x), putchar(32);}
	inline void eprint(int x){write(x), putchar(10);}
}using namespace IO;

const int MAXN = 1e5+5;

int n;
int u, d, l, r;
int x[MAXN], y[MAXN], dx, dy;

vc<PI> ans;

signed main(){
	n=read();
	if(n<=4){
		puts("Yes");
		for(int i=1;i<=n;++i) sprint(i), eprint(i);
		eprint(0);	
		return 0;
	}
	if((n&1) || n==6) return puts("No"), 0;
	if(n%4==0) dx=1e5, dy=1;
	else dx=1, dy=1e5;
	x[1]=-dx, x[2]=dx, y[3]=-dy, y[4]=dy, y[6]=2*dy, y[5]=-2*dy; 
	l=1, r=2; u=6, d=5; ans.pb(mk(1,2)); ans.pb(mk(3,5)); ans.pb(mk(4,6));
	ans.pb(mk(1,3)); ans.pb(mk(1,4)); ans.pb(mk(1,6)); ans.pb(mk(1,5));
	ans.pb(mk(2,3)); ans.pb(mk(2,4)); ans.pb(mk(2,6)); ans.pb(mk(2,5));
	for(int i=6, j=0;i<n;i+=2, j^=1){
		if(j==0){
			//cerr << "i+1=" << i+1 << endl;
			x[i+1]=x[l]-dx, x[i+2]=x[r]+dx;
			ans.pb(mk(l,i+1)); ans.pb(mk(i+2,r));
			ans.pb(mk(u,i+1)); ans.pb(mk(u,i+2));
			ans.pb(mk(d,i+1)); ans.pb(mk(d,i+2));
			l=i+1, r=i+2;
		}
		else{
			//cerr << "i+1=" << i+1 << endl;
			y[i+1]=y[d]-dy, y[i+2]=y[u]+dy;
			ans.pb(mk(d,i+1)); ans.pb(mk(i+2,u));
			ans.pb(mk(l,i+1)); ans.pb(mk(l,i+2));
			ans.pb(mk(r,i+1)); ans.pb(mk(r,i+2));
			d=i+1, u=i+2;
		}
	}
	if(n%4==0) x[n-3]=1e8, x[n-2]=1e8, y[n-3]=-1e9, y[n-2]=1e9;
	else x[n-3]=1e9, x[n-2]=1e9, y[n-3]=-1e8, y[n-2]=1e8; ans.pb(mk(n-3,n-2));
	puts("Yes");
	for(int i=1;i<=n;++i) sprint(x[i]), eprint(y[i]);
	eprint(ans.size());
	for(auto i:ans) sprint(i.fi), eprint(i.se);
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3

output:

Yes
1 1
2 2
3 3
0

result:

ok OK, Accepted.

Test #2:

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

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

input:

1

output:

Yes
1 1
0

result:

ok OK, Accepted.

Test #4:

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

input:

2

output:

Yes
1 1
2 2
0

result:

ok OK, Accepted.

Test #5:

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

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

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

input:

6

output:

No

result:

ok OK, Accepted.

Test #7:

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

input:

7

output:

No

result:

ok OK, Accepted.

Test #8:

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

input:

8

output:

Yes
-100000 0
100000 0
0 -1
0 1
100000000 -1000000000
100000000 1000000000
-200000 0
200000 0
18
1 2
3 5
4 6
1 3
1 4
1 6
1 5
2 3
2 4
2 6
2 5
1 7
8 2
6 7
6 8
5 7
5 8
5 6

result:

ok OK, Accepted.

Test #9:

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

input:

9

output:

No

result:

ok OK, Accepted.

Test #10:

score: -100
Wrong Answer
time: 0ms
memory: 3740kb

input:

10

output:

Yes
-1 0
1 0
0 -100000
0 100000
0 -200000
0 200000
1000000000 -100000000
1000000000 100000000
0 -300000
0 300000
24
1 2
3 5
4 6
1 3
1 4
1 6
1 5
2 3
2 4
2 6
2 5
1 7
8 2
6 7
6 8
5 7
5 8
5 9
10 6
7 9
7 10
8 9
8 10
7 8

result:

wrong answer Invalid Planar Graph : segments (2, 3) and (1, 7) intersect