QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#35251 | #960. Output Limit Exceeded | Froggygua | AC ✓ | 28ms | 3764kb | C++17 | 1.5kb | 2022-06-14 19:28:53 | 2022-06-14 19:28:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define N 205
typedef long long ll;
ll n;
int match[N];
bool G[N][N];
bool vis[N];
bool dfs(int u,int n){
for(int v=1;v<=n;++v){
if(vis[v]||!G[u][v])continue;
vis[v]=1;
if(!match[v]||dfs(match[v],n)){
match[v]=u;
return true;
}
}
return false;
}
bool check(int n){
memset(match,0,sizeof(match));
for(int i=1;i<=n;++i){
memset(vis,0,sizeof(vis));
if(!dfs(i,n))return false;
}
return true;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
vector<int> ans;
for(int i=0;i<=min(200LL,n);++i){
memset(G,false,sizeof(G));
for(int u=1;u<=i;++u){
for(int v=1;v<=i;++v){
if((n-u+1)%v==0){
G[u][v]=1;
}
}
}
ans.push_back(check(i));
}
if(n<=401){
for(int i=(int)ans.size();i<=n;++i){
ans.push_back(ans[n-i]);
}
cout<<2<<'\n';
cout<<ans.size()<<' ';
for(auto x:ans)cout<<x<<' ';
cout<<'\n';
}
else{
cout<<64<<'\n';
for(int i=1;i<=60;++i){
cout<<2<<' '<<(i==1?0:i)<<' '<<(i==1?0:i)<<'\n';
}
cout<<ans.size()<<' ';
for(auto x:ans)cout<<x<<' ';
cout<<'\n';
reverse(ans.begin(),ans.end());
cout<<ans.size()<<' ';
for(auto x:ans)cout<<x<<' ';
cout<<'\n';
vector<int> jb({62});
ll rem=n+1-2*ans.size();
for(int i=0;i<=60;++i){
if(rem>>i&1){
jb.push_back(!i?0:i+1);
}
}
jb.push_back(63);
cout<<jb.size()<<' ';
for(auto x:jb)cout<<x<<' ';
cout<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3580kb
input:
1
output:
2 2 1 1
result:
ok OK 2 ones: 0 1
Test #2:
score: 0
Accepted
time: 2ms
memory: 3588kb
input:
0
output:
2 1 1
result:
ok OK 1 ones: 0
Test #3:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
7
output:
2 8 1 1 1 0 0 1 1 1
result:
ok OK 6 ones: 0 1 2 5 6 7
Test #4:
score: 0
Accepted
time: 21ms
memory: 3752kb
input:
1000
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 18 ones: 0 1 2 3 4 5 6 7 9 991 993 994 995 996 997 998 999 1000
Test #5:
score: 0
Accepted
time: 25ms
memory: 3764kb
input:
1000000000000000000
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 14 ones: 0 1 2 3 4 5 6 999999999999999994 999999999999999995 999999999999999996 999999999999999997 999999999999999998 999999999999999999 1000000000000000000
Test #6:
score: 0
Accepted
time: 25ms
memory: 3592kb
input:
987654321987654321
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 10 ones: 0 1 2 3 4 987654321987654317 987654321987654318 987654321987654319 987654321987654320 987654321987654321
Test #7:
score: 0
Accepted
time: 26ms
memory: 3700kb
input:
268571729873867564
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 8 ones: 0 1 2 3 268571729873867561 268571729873867562 268571729873867563 268571729873867564
Test #8:
score: 0
Accepted
time: 26ms
memory: 3672kb
input:
7900225
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 18 ones: 0 1 2 5 6 19 20 25 26 7900199 7900200 7900205 7900206 7900219 7900220 7900223 7900224 7900225
Test #9:
score: 0
Accepted
time: 27ms
memory: 3604kb
input:
1690950
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 22 ones: 0 1 2 3 4 5 6 7 23 24 25 1690925 1690926 1690927 1690943 1690944 1690945 1690946 1690947 1690948 1690949 1690950
Test #10:
score: 0
Accepted
time: 26ms
memory: 3748kb
input:
3299430
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 20 ones: 0 1 2 3 4 5 6 7 8 27 3299403 3299422 3299423 3299424 3299425 3299426 3299427 3299428 3299429 3299430
Test #11:
score: 0
Accepted
time: 26ms
memory: 3752kb
input:
3755426
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 12 ones: 0 1 2 3 7 27 3755399 3755419 3755423 3755424 3755425 3755426
Test #12:
score: 0
Accepted
time: 26ms
memory: 3648kb
input:
7900224
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 26 ones: 0 1 2 3 4 5 19 20 21 22 23 24 25 7900199 7900200 7900201 7900202 7900203 7900204 7900205 7900219 7900220 7900221 7900222 7900223 7900224
Test #13:
score: 0
Accepted
time: 27ms
memory: 3648kb
input:
582120
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 34 ones: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 23 24 25 582095 582096 582097 582107 582108 582109 582110 582111 582112 582113 582114 582115 582116 582117 582118 582119 582120
Test #14:
score: 0
Accepted
time: 26ms
memory: 3652kb
input:
186145
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 12 ones: 0 1 2 5 6 26 186119 186139 186140 186143 186144 186145
Test #15:
score: 0
Accepted
time: 27ms
memory: 3704kb
input:
5392796
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 20 ones: 0 1 2 3 5 6 7 8 9 25 5392771 5392787 5392788 5392789 5392790 5392791 5392793 5392794 5392795 5392796
Test #16:
score: 0
Accepted
time: 26ms
memory: 3704kb
input:
1690947
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 14 ones: 0 1 2 3 4 5 25 1690922 1690942 1690943 1690944 1690945 1690946 1690947
Test #17:
score: 0
Accepted
time: 27ms
memory: 3680kb
input:
763452298
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 22 ones: 0 1 2 3 4 5 6 7 8 9 29 763452269 763452289 763452290 763452291 763452292 763452293 763452294 763452295 763452296 763452297 763452298
Test #18:
score: 0
Accepted
time: 22ms
memory: 3752kb
input:
701578836
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 26 ones: 0 1 2 3 4 5 6 7 8 9 10 11 29 701578807 701578825 701578826 701578827 701578828 701578829 701578830 701578831 701578832 701578833 701578834 701578835 701578836
Test #19:
score: 0
Accepted
time: 27ms
memory: 3592kb
input:
308897850
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 18 ones: 0 1 2 3 4 5 6 7 27 308897823 308897843 308897844 308897845 308897846 308897847 308897848 308897849 308897850
Test #20:
score: 0
Accepted
time: 26ms
memory: 3588kb
input:
377596828
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 18 ones: 0 1 2 3 4 5 6 23 27 377596801 377596805 377596822 377596823 377596824 377596825 377596826 377596827 377596828
Test #21:
score: 0
Accepted
time: 27ms
memory: 3600kb
input:
524422078
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 42 ones: 0 1 2 3 4 5 6 7 8 9 10 11 16 17 18 19 20 21 23 27 29 524422049 524422051 524422055 524422057 524422058 524422059 524422060 524422061 524422062 524422067 524422068 524422069 524422070 524422071 524422072 524422073 524422074 524422075 524422076 524422077 524422078
Test #22:
score: 0
Accepted
time: 28ms
memory: 3700kb
input:
906130371972379050
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 20 ones: 0 1 2 3 4 5 6 7 8 31 906130371972379019 906130371972379042 906130371972379043 906130371972379044 906130371972379045 906130371972379046 906130371972379047 906130371972379048 906130371972379049 906130371972379050
Test #23:
score: 0
Accepted
time: 26ms
memory: 3756kb
input:
9469980
output:
64 2 0 0 2 2 2 2 3 3 2 4 4 2 5 5 2 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 11 11 2 12 12 2 13 13 2 14 14 2 15 15 2 16 16 2 17 17 2 18 18 2 19 19 2 20 20 2 21 21 2 22 22 2 23 23 2 24 24 2 25 25 2 26 26 2 27 27 2 28 28 2 29 29 2 30 30 2 31 31 2 32 32 2 33 33 2 34 34 2 35 35 2 36 36 2 37 37 2 38 38 2 39 39 2 4...
result:
ok OK 18 ones: 0 1 2 3 4 5 6 7 31 9469949 9469973 9469974 9469975 9469976 9469977 9469978 9469979 9469980