QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#440154 | #8675. Schedule | A_zjzj | AC ✓ | 1ms | 3936kb | C++17 | 966b | 2024-06-13 10:36:47 | 2024-06-13 10:36:48 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include"debug.h"
#else
#define debug(...) void()
#endif
#define all(x) (x).begin(),(x).end()
template<class T>
auto ary(T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
using ll=long long;
using ull=unsigned ll;
int n,m,k;
vector<string>ans;
int C(int n,int m){
int ans=1;
for(int i=0;i<m;i++){
ans=ans*(n-i)/(i+1);
}
return ans;
}
int calc(int k){
return C(k-1,(k-1)/2+1);
}
int main(){
cin>>n>>m;
for(k=1;calc(k)<n;k++);
vector<int>cur;
for(int S=0;S<(1<<k-1);S++){
if(__builtin_popcount(S)==(k-1)/2+1)cur.push_back(S);
}
cur.resize(n);
for(int i=0;i<k;i++){
string str(n,'1');
for(int j=0;j<n;j++)str[j]=cur[j]>>i&1?'1':'2';
ans.push_back(str);
}
debug(ans);
if(m<ans.size())puts("infinity"),exit(0);
cout<<ans.size()<<'\n';
for(int i=0;i<m;i++)cout<<ans[i%ans.size()]<<'\n';
return 0;
}
#ifdef DEBUG
#include"debug.hpp"
#endif
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3772kb
input:
4 4
output:
infinity
result:
ok infinity
Test #2:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
3 4
output:
4 112 121 211 222
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
4 15
output:
5 1112 1121 1211 2111 2222 1112 1121 1211 2111 2222 1112 1121 1211 2111 2222
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
5 52
output:
6 11121 11211 12112 21112 22221 22222 11121 11211 12112 21112 22221 22222 11121 11211 12112 21112 22221 22222 11121 11211 12112 21112 22221 22222 11121 11211 12112 21112 22221 22222 11121 11211 12112 21112 22221 22222 11121 11211 12112 21112 22221 22222 11121 11211 12112 21112 22221 22222 11121 1121...
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
10 52
output:
6 1112112122 1121121212 1211211221 2111222111 2222111111 2222222222 1112112122 1121121212 1211211221 2111222111 2222111111 2222222222 1112112122 1121121212 1211211221 2111222111 2222111111 2222222222 1112112122 1121121212 1211211221 2111222111 2222111111 2222222222 1112112122 1121121212 1211211221 2...
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
11 52
output:
7 11112111211 11121112112 11211121121 12111211122 21111222211 22222111111 22222222222 11112111211 11121112112 11211121121 12111211122 21111222211 22222111111 22222222222 11112111211 11121112112 11211121121 12111211122 21111222211 22222111111 22222222222 11112111211 11121112112 11211121121 1211121112...
result:
ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
15 52
output:
7 111121112112122 111211121121212 112111211211221 121112111222111 211112222111111 222221111111111 222222222222222 111121112112122 111211121121212 112111211211221 121112111222111 211112222111111 222221111111111 222222222222222 111121112112122 111211121121212 112111211211221 121112111222111 2111122221...
result:
ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
16 52
output:
8 1111211121121221 1112111211212121 1121112112112211 1211121112221112 2111122221111112 2222211111111112 2222222222222221 2222222222222222 1111211121121221 1112111211212121 1121112112112211 1211121112221112 2111122221111112 2222211111111112 2222222222222221 2222222222222222 1111211121121221 111211121...
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
35 52
output:
8 11112111211212211121121221121221222 11121112112121211211212121212122122 11211121121122112112112212112212212 12111211122211121112221112221112221 21111222211111122221111112222221111 22222111111111122222222221111111111 22222222222222211111111111111111111 22222222222222222222222222222222222 1111211121...
result:
ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
36 52
output:
9 111112111121112112122111121112112122 111121111211121121212111211121121212 111211112111211211221112111211211221 112111121112111222111121112111222111 121111211112222111111211112222111111 211111222221111111111222221111111111 222222111111111111111222222222222222 222222222222222222222111111111111111 22...
result:
ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
56 52
output:
9 11111211112111211212211112111211212211121121221121221222 11112111121112112121211121112112121211211212121212122122 11121111211121121122111211121121122112112112212112212212 11211112111211122211112111211122211121112221112221112221 12111121111222211111121111222211111122221111112222221111 2111112222211...
result:
ok
Test #12:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
57 52
output:
10 111112111121112112122111121112112122111211212211212212221 111121111211121121212111211121121212112112121212121221221 111211112111211211221112111211211221121121122121122122121 112111121112111222111121112111222111211122211122211122211 121111211112222111111211112222111111222211111122222211112 2111112...
result:
ok
Test #13:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
126 52
output:
10 111112111121112112122111121112112122111211212211212212221111211121121221112112122112122122211121121221121221222112122122212222 111121111211121121212111211121121212112112121212121221221112111211212121121121212121212212211211212121212122122121212212221222 1112111121112112112211121112112112211211211...
result:
ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
127 52
output:
11 1111112111112111121112112122111112111121112112122111121112112122111211212211212212221111121111211121121221111211121121221112112 1111121111121111211121121212111121111211121121212111211121121212112112121212121221221111211112111211212121112111211212121121121 11112111112111121112112112211112111121112...
result:
ok
Test #15:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
792 52
output:
13 111111121111112111112111121112112122111111211111211112111211212211111211112111211212211112111211212211121121221121221222111111211111211112111211212211111211112111211212211112111211212211121121221121221222111112111121112112122111121112112122111211212211212212221111211121121221112112122112122122211...
result:
ok
Test #16:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
793 52
output:
14 111111121111112111112111121112112122111111211111211112111211212211111211112111211212211112111211212211121121221121221222111111211111211112111211212211111211112111211212211112111211212211121121221121221222111112111121112112122111121112112122111211212211212212221111211121121221112112122112122122211...
result:
ok
Test #17:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
6435 52
output:
16 111111112111111121111112111112111121112112122111111121111112111112111121112112122111111211111211112111211212211111211112111211212211112111211212211121121221121221222111111121111112111112111121112112122111111211111211112111211212211111211112111211212211112111211212211121121221121221222111111211111...
result:
ok
Test #18:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
6436 52
output:
17 111111111211111111211111112111111211111211112111211212211111111211111112111111211111211112111211212211111112111111211111211112111211212211111121111121111211121121221111121111211121121221111211121121221112112122112122122211111111211111112111111211111211112111211212211111112111111211111211112111211...
result:
ok
Test #19:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
792 10
output:
infinity
result:
ok infinity
Test #20:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
5000 52
output:
16 111111112111111121111112111112111121112112122111111121111112111112111121112112122111111211111211112111211212211111211112111211212211112111211212211121121221121221222111111121111112111112111121112112122111111211111211112111211212211111211112111211212211112111211212211121121221121221222111111211111...
result:
ok
Test #21:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
10000 52
output:
17 111111111211111111211111112111111211111211112111211212211111111211111112111111211111211112111211212211111112111111211111211112111211212211111121111121111211121121221111121111211121121221111211121121221112112122112122122211111111211111112111111211111211112111211212211111112111111211111211112111211...
result:
ok
Test #22:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
2 3
output:
infinity
result:
ok infinity
Test #23:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
3 3
output:
infinity
result:
ok infinity
Test #24:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 5
output:
5 1112 1121 1211 2111 2222
result:
ok
Test #25:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
5 5
output:
infinity
result:
ok infinity
Test #26:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
11 6
output:
infinity
result:
ok infinity
Test #27:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
11 7
output:
7 11112111211 11121112112 11211121121 12111211122 21111222211 22222111111 22222222222
result:
ok
Test #28:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
127 10
output:
infinity
result:
ok infinity
Test #29:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
6436 16
output:
infinity
result:
ok infinity
Test #30:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
6436 17
output:
17 111111111211111111211111112111111211111211112111211212211111111211111112111111211111211112111211212211111112111111211111211112111211212211111121111121111211121121221111121111211121121221111211121121221112112122112122122211111111211111112111111211111211112111211212211111112111111211111211112111211...
result:
ok
Extra Test:
score: 0
Extra Test Passed