QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321845#8215. Isomorphic DelightyyyyxhWA 0ms3584kbC++23846b2024-02-05 18:00:252024-02-05 18:00:25

Judging History

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

  • [2024-02-05 18:00:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2024-02-05 18:00:25]
  • 提交

answer

#include <cstdio>
using namespace std;
const int N=1000003;
int n;
int su[N],sv[N],tp;
void add(int u,int v){++tp;su[tp]=u;sv[tp]=v;}
int main(){
	scanf("%d",&n);
	if(n==1){
		puts("YES");
		puts("0");
		return 0;
	}
	if(n<=5){
		puts("NO");
		return 0;
	}
	if(n==6){
		puts("YES");
		puts("6");
		puts("1 2");
		puts("2 3");
		puts("1 3");
		puts("3 4");
		puts("2 5");
		puts("5 6");
		return 0;
	}
	if(n==7){
		puts("YES");
		printf("%d\n",n-1);
		for(int i=2;i<n;++i) printf("%d %d\n",i-1,i);
		printf("3 %d\n",n);
		return 0;
	}
	puts("YES");
	--n;
	for(int i=7;i<=n;++i)
		if(i>n) break;
		else{
			for(int j=2;j<i;++j) add(n-i+j-1,n-i+j);
			add(n-3,n);
			n-=i;
		}
	int t=n+1;
	while(n) add(n--,t);
	printf("%d\n",tp);
	for(int i=1;i<=tp;++i) printf("%d %d\n",su[i],sv[i]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

YES
0

result:

ok Everything ok

Test #2:

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

input:

6

output:

YES
6
1 2
2 3
1 3
3 4
2 5
5 6

result:

ok Everything ok

Test #3:

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

input:

4

output:

NO

result:

ok Everything ok

Test #4:

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

input:

2

output:

NO

result:

ok Everything ok

Test #5:

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

input:

3

output:

NO

result:

ok Everything ok

Test #6:

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

input:

5

output:

NO

result:

ok Everything ok

Test #7:

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

input:

7

output:

YES
6
1 2
2 3
3 4
4 5
5 6
3 7

result:

ok Everything ok

Test #8:

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

input:

8

output:

YES
6
1 2
2 3
3 4
4 5
5 6
4 7

result:

ok Everything ok

Test #9:

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

input:

9

output:

YES
7
2 3
3 4
4 5
5 6
6 7
5 8
1 2

result:

ok Everything ok

Test #10:

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

input:

10

output:

YES
8
3 4
4 5
5 6
6 7
7 8
6 9
2 3
1 3

result:

wrong answer Not asymmetric