QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#320198 | #8215. Isomorphic Delight | ucup-team266# | WA | 0ms | 3684kb | C++20 | 2.4kb | 2024-02-03 14:30:42 | 2024-02-03 14:30:42 |
Judging History
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;
}
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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3684kb
input:
1
output:
YES 0
result:
ok Everything ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3604kb
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: 3668kb
input:
4
output:
NO
result:
ok Everything ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2
output:
NO
result:
ok Everything ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
3
output:
NO
result:
ok Everything ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5
output:
NO
result:
ok Everything ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 3576kb
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: 3608kb
input:
8
output:
YES 8 1 2 2 3 3 1 1 4 4 5 2 6 6 7 7 8
result:
wrong answer contestant's solution is worse (more edges) than jury's