QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#320314 | #8215. Isomorphic Delight | ucup-team266# | WA | 1ms | 3872kb | C++20 | 1.8kb | 2024-02-03 15:33:29 | 2024-02-03 15:33:30 |
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;
void construct(int cnt,int del)
{
// if(cnt==7)
// {
//
// cout<<del+1<<" "<<del+2<<"\n";
// cout<<del+2<<" "<<del+3<<"\n";
// cout<<del+3<<" "<<del+1<<"\n";
// cout<<del+1<<" "<<del+4<<"\n";
// cout<<del+4<<" "<<del+5<<"\n";
// cout<<del+2<<" "<<del+6<<"\n";
// return;
// }
cout<<del+1<<" "<<del+2<<"\n";
cout<<del+1<<" "<<del+3<<"\n";
cout<<del+1<<" "<<del+4<<"\n";
cout<<del+3<<" "<<del+5<<"\n";
cout<<del+2<<" "<<del+6<<"\n";
for(int i=7;i<=cnt;i++) cout<<i-1+del<<" "<<i+del<<"\n";
}
void solve()
{
cin>>n;
if(n==1)
{
cout<<"YES\n0\n";
return;
}
if(n<=5)
{
cout<<"NO\n";
return;
}
if(n==6||n==7)
{
cout<<"YES\n6\n";
cout<<"1 2\n2 3\n3 1\n1 4\n4 5\n2 6\n";
return;
}
vector <int> vec;
for(int x=7,y=n-1;1;)
{
if(x<=y)
{
vec.pb(x);
y-=x,x++;
}
else
{
vec.back()+=y;
break;
}
}
int tot=0;
for(int i=0;i<vec.size();i++) tot+=vec[i]-1;
cout<<"YES\n"<<tot<<"\n";
for(int i=0,del=0;i<vec.size();i++) construct(vec[i],del),del+=vec[i];
}
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: 1ms
memory: 3636kb
input:
1
output:
YES 0
result:
ok Everything ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
6
output:
YES 6 1 2 2 3 3 1 1 4 4 5 2 6
result:
ok Everything ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
4
output:
NO
result:
ok Everything ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
2
output:
NO
result:
ok Everything ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
3
output:
NO
result:
ok Everything ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
5
output:
NO
result:
ok Everything ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
7
output:
YES 6 1 2 2 3 3 1 1 4 4 5 2 6
result:
ok Everything ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
8
output:
YES 6 1 2 1 3 1 4 3 5 2 6 6 7
result:
ok Everything ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
9
output:
YES 7 1 2 1 3 1 4 3 5 2 6 6 7 7 8
result:
ok Everything ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
10
output:
YES 8 1 2 1 3 1 4 3 5 2 6 6 7 7 8 8 9
result:
ok Everything ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
11
output:
YES 9 1 2 1 3 1 4 3 5 2 6 6 7 7 8 8 9 9 10
result:
ok Everything ok
Test #12:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
12
output:
YES 10 1 2 1 3 1 4 3 5 2 6 6 7 7 8 8 9 9 10 10 11
result:
ok Everything ok
Test #13:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
13
output:
YES 11 1 2 1 3 1 4 3 5 2 6 6 7 7 8 8 9 9 10 10 11 11 12
result:
ok Everything ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
14
output:
YES 12 1 2 1 3 1 4 3 5 2 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13
result:
ok Everything ok
Test #15:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
15
output:
YES 13 1 2 1 3 1 4 3 5 2 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14
result:
ok Everything ok
Test #16:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
16
output:
YES 13 1 2 1 3 1 4 3 5 2 6 6 7 8 9 8 10 8 11 10 12 9 13 13 14 14 15
result:
ok Everything ok
Test #17:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
17
output:
YES 14 1 2 1 3 1 4 3 5 2 6 6 7 8 9 8 10 8 11 10 12 9 13 13 14 14 15 15 16
result:
ok Everything ok
Test #18:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
18
output:
YES 15 1 2 1 3 1 4 3 5 2 6 6 7 8 9 8 10 8 11 10 12 9 13 13 14 14 15 15 16 16 17
result:
ok Everything ok
Test #19:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
19
output:
YES 16 1 2 1 3 1 4 3 5 2 6 6 7 8 9 8 10 8 11 10 12 9 13 13 14 14 15 15 16 16 17 17 18
result:
ok Everything ok
Test #20:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
598
output:
YES 569 1 2 1 3 1 4 3 5 2 6 6 7 8 9 8 10 8 11 10 12 9 13 13 14 14 15 16 17 16 18 16 19 18 20 17 21 21 22 22 23 23 24 25 26 25 27 25 28 27 29 26 30 30 31 31 32 32 33 33 34 35 36 35 37 35 38 37 39 36 40 40 41 41 42 42 43 43 44 44 45 46 47 46 48 46 49 48 50 47 51 51 52 52 53 53 54 54 55 55 56 56 57 58 ...
result:
wrong answer contestant's solution is worse (more edges) than jury's