QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#320215#8215. Isomorphic Delightucup-team266#WA 0ms3696kbC++202.5kb2024-02-03 14:38:312024-02-03 14:38:33

Judging History

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

  • [2024-02-03 14:38:33]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3696kb
  • [2024-02-03 14:38:31]
  • 提交

answer

/*
Things to notice:
1. do not calculate useless values
2. do not use similar names
 
Things to check:
1. submit the correct file
2. time (it is log^2 or log)
3. memory
4. prove your naive thoughts 
5. long long
6. corner case like n=0,1,inf or n=m
7. check if there is a mistake in the ds or other tools you use
8. fileio in some oi-contest

9. module on time 
10. the number of a same divisor in a math problem
11. multi-information and queries for dp and ds problems
*/
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
const int mod=998244353;
const int inf=0x3f3f3f3f;
int n,g[15][15],per[15];
//bool chk()
//{
//	for(int i=1;i<=n;i++) per[i]=i;
//	next_permutation(per+1,per+1+n);
//	do
//	{
//		int flg=1;
//		for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) if(g[i][j]!=g[per[i]][per[j]])
//		{
////			return 0;
//			flg=0;
////			break;
//		}
//		if(flg)
//		
//		{
//			return 0;
//			cout<<"bad: \n";
//			for(int i=1;i<=n;i++) cout<<per[i]<<" ";
//			cout<<"\n";
//		}
//	}while(next_permutation(per+1,per+1+n));
//	return 1;
//}
void solve()
{
	cin>>n;
	if(n==1)
	{
		cout<<"YES\n0\n";
		return;
	}
	if(n<=5)
	{
		cout<<"NO\n";
		return;
	}
	if(n==8)
	{
		cout<<"YES\n7\n";
		cout<<"1 2\n2 3\n3 4\n4 1\n1 5\n5 6\n2 7\n";
		return;
	}
	cout<<"YES\n"<<n-n%2<<"\n";
	if(n%2==1) n--;
	cout<<"1 2\n2 3\n3 1\n";
	int uidx=4;
	for(int i=1;i<=(n-3)/2;i++) 
	{
		if(i==1) cout<<"1 "<<uidx<<"\n",uidx++;
		else cout<<uidx-1<<" "<<uidx<<"\n",uidx++;
	}
	for(int i=1;i<=(n-3)/2+1;i++) 
	{
		if(i==1) cout<<"2 "<<uidx<<"\n",uidx++;
		else cout<<uidx-1<<" "<<uidx<<"\n",uidx++;
	}
	
//	int m;
//	cin>>m;
//	
//		while(m--)
//		{
//			int u,v;
//			cin>>u>>v;
//			g[u][v]=g[v][u]=1;
//		}
//		if(chk()) cerr<<"ok\n";
//	int tot=n*(n-1)/2;
//	for(int mask=0;mask<(1<<tot);mask++) //if(__builtin_popcount(mask)==m)
//	{
//
//		memset(g,0,sizeof(g));
//		int idx=0;
//		for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++)
//		{
//			if(mask&(1<<idx)) g[i][j]=g[j][i]=1;
//			idx++;
//		}
		
//		{
//			idx=0;
//			for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++)
//			{
//				if(mask&(1<<idx)) cout<<i<<" "<<j<<"\n";
//				idx++;
//			}
//			return;
//		}
//	} 
//	while(m--)
//	{
//		int x,y;
//		cin>>x>>y;
//		g[x][y]=g[y][x]=1;
//	}
	
}
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int _=1;
//	cin>>_;
	while(_--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

YES
0

result:

ok Everything ok

Test #2:

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

input:

6

output:

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

result:

ok Everything ok

Test #3:

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

input:

4

output:

NO

result:

ok Everything ok

Test #4:

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

input:

2

output:

NO

result:

ok Everything ok

Test #5:

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

input:

3

output:

NO

result:

ok Everything ok

Test #6:

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

input:

5

output:

NO

result:

ok Everything ok

Test #7:

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

input:

7

output:

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

result:

ok Everything ok

Test #8:

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

input:

8

output:

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

result:

wrong answer contestant's solution is worse (more edges) than jury's