QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#321844#8215. Isomorphic DelightyyyyxhWA 0ms3660kbC++23812b2024-02-05 17:58:322024-02-05 17:58:32

Judging History

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

  • [2024-02-05 17:58:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3660kb
  • [2024-02-05 17:58:32]
  • 提交

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-i+3,n);
			n-=i;
		}
	printf("%d\n",tp);
	for(int i=1;i<=tp;++i) printf("%d %d\n",su[i],sv[i]);
	return 0;
}

詳細信息

Test #1:

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

input:

1

output:

YES
0

result:

ok Everything ok

Test #2:

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

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

input:

4

output:

NO

result:

ok Everything ok

Test #4:

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

input:

2

output:

NO

result:

ok Everything ok

Test #5:

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

input:

3

output:

NO

result:

ok Everything ok

Test #6:

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

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

input:

8

output:

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

result:

ok Everything ok

Test #9:

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

input:

9

output:

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

result:

wrong answer Not asymmetric