QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#602465 | #34. Friends | real_sigma_team | 88 | 148ms | 10048kb | C++17 | 2.9kb | 2024-10-01 01:39:40 | 2024-10-01 01:39:40 |
Judging History
answer
// what is matter? never mind.
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 3000005
#define inf 0x3f3f3f3f
int n,p,q;
bool e[2505][2505];
vi g[2505];
int col[2505],cnt;
vi vec[2505];
int check(vi o){
if(o.size()>p)return p+q+1;
int sum=0;
for(int u:o)sum+=g[u].size();
for(int u:o)for(int v:o)sum-=e[u][v];
return sum;
}
bool orz[2505];
vi outs(vi a,vi b){
vi c;
for(auto x:b)orz[x]=1;
for(auto x:a)if(!orz[x])c.pb(x);
for(auto x:b)orz[x]=0;
return c;
}
bool in(vi &a,vi &b){
bool hav=1;
for(auto x:b)orz[x]=1;
for(auto x:a)if(!orz[x])hav=0;
for(auto x:b)orz[x]=0;
return hav;
}
mt19937_64 rnd(19890531);
vi ans;
map<vi,bool>mp;
bool dfs(vi o){
// cout<<"dfs: ";for(auto x:o)cout<<x<<" ";puts("");
if(o.size()>p)return 0;
int qwq=check(o);
if(qwq<=q){
ans=o;
return 1;
}
if(qwq>p+q)return 0;
sort(o.begin(),o.end());
if(mp.count(o))return 0;
set<int>pos;
for(auto x:o)for(auto y:g[x])pos.insert(y);
for(auto x:o)pos.erase(x);
// for(auto t:o)cout<<t<<" ";puts("");
vi vc;
for(auto x:pos)vc.pb(x);
shuffle(vc.begin(),vc.end(),rnd);
int siz=vc.size();
// cout<<"siz: ";for(int x:vc)cout<<x<<" ";puts("");
For(i,1,(1<<siz)-1)
if(__builtin_popcount(i)+o.size()<=p){
vi oo=o;
For(j,0,siz-1)if(i>>j&1)oo.pb(vc[j]);
if(dfs(oo))return 1;
}
mp[o]=1;
return 0;
}
signed main()
{
// freopen("test31_true.in","r",stdin);
n=read(),p=read(),q=read();
For(i,0,n-1){
g[i].resize(read());
for(auto&x:g[i])x=read(),e[i][x]=1;
}
For(i,0,n-1)For(j,0,n-1)if(e[i][j]&&!e[j][i])puts("detention"),exit(0);
For(i,0,n-1)if(g[i].size()>p+q)puts("detention"),exit(0);
For(i,0,n-1){
if(col[i])continue;
// int m=g[i].size();
mp.clear();
vi o={i}; ans.clear();
if(!dfs(o)){
puts("detention");
exit(0);
}
vec[i]=ans;
for(auto x:vec[i])col[x]=1;
}
For(i,0,n)col[i]=0;
For(i,0,n-1)
For(j,i+1,n-1){
if(in(vec[i],vec[j])){vec[i].clear();continue;}
if(in(vec[j],vec[i])){vec[j].clear();continue;}
vi o1=outs(vec[i],vec[j]);
if(check(o1)<=q){vec[i]=o1;continue;}
vi o2=outs(vec[j],vec[i]);
if(check(o2)<=q){vec[j]=o2;continue;}
assert(0);
}
puts("home");
vector<vi>res;
For(i,0,n-1)
if(!col[i] && vec[i].size()){
for(auto u:vec[i]) col[u]=1;
res.pb(vec[i]);
}
cout<<res.size()<<"\n";
for(auto t:res){
cout<<t.size()<<" ";
for(int x:t)cout<<x<<" ";
puts("");
}
return 0;
}
详细
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 1ms
memory: 3752kb
input:
2 2 2 1 1 0
output:
detention
result:
ok no solution
Test #2:
score: 20
Accepted
time: 0ms
memory: 3772kb
input:
5 1 2 2 1 4 2 0 2 2 1 4 0 2 0 2
output:
home 5 1 0 1 1 1 2 1 3 1 4
result:
ok correct plan!
Test #3:
score: 20
Accepted
time: 0ms
memory: 4012kb
input:
10 2 2 2 1 5 2 0 2 2 1 3 2 2 4 1 3 1 0 1 7 1 6 1 9 1 8
output:
home 10 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9
result:
ok correct plan!
Test #4:
score: 20
Accepted
time: 0ms
memory: 3788kb
input:
15 2 3 3 1 2 3 2 0 2 3 0 1 3 3 0 2 4 4 3 5 6 8 1 4 2 4 7 3 6 8 9 3 4 7 9 2 7 8 2 11 13 3 10 12 13 2 11 13 3 10 11 12 0
output:
home 14 1 0 1 1 1 2 1 3 2 4 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14
result:
ok correct plan!
Test #5:
score: 20
Accepted
time: 1ms
memory: 4016kb
input:
16 3 3 2 1 2 3 0 2 7 4 0 1 6 9 2 4 14 3 3 12 13 2 6 7 3 2 5 7 3 1 5 6 0 2 2 14 2 11 12 2 10 12 3 4 10 11 3 4 14 15 4 3 9 13 15 2 13 14
output:
home 12 3 1 2 0 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 3 13 14 15
result:
ok correct plan!
Test #6:
score: 20
Accepted
time: 1ms
memory: 3732kb
input:
16 4 4 3 1 2 3 3 0 2 3 6 0 1 3 5 6 9 4 0 1 2 11 4 5 6 7 15 5 2 4 6 7 15 4 2 4 5 7 3 4 5 6 3 9 10 11 5 2 8 10 11 14 5 8 9 11 12 13 4 3 8 9 10 4 10 13 14 15 4 10 12 14 15 4 9 12 13 15 5 4 5 12 13 14
output:
detention
result:
ok no solution
Test #7:
score: 20
Accepted
time: 1ms
memory: 3780kb
input:
16 3 3 3 1 3 6 3 0 2 3 2 1 3 4 0 1 2 12 2 5 6 4 4 6 13 14 4 0 4 5 13 3 8 9 15 2 7 9 2 7 8 2 11 12 2 10 12 3 3 10 11 4 5 6 14 15 3 5 13 15 3 7 13 14
output:
detention
result:
ok no solution
Test #8:
score: 20
Accepted
time: 0ms
memory: 3776kb
input:
16 5 5 3 1 2 4 1 0 2 0 3 4 2 4 5 13 3 0 1 3 5 3 6 7 8 9 3 5 7 9 6 5 6 8 9 12 14 4 5 7 9 14 4 5 6 7 8 4 11 12 13 14 4 10 12 13 14 5 7 10 11 13 14 4 3 10 11 12 5 7 8 10 11 12 0
output:
detention
result:
ok no solution
Subtask #2:
score: 37
Accepted
Test #9:
score: 37
Accepted
time: 1ms
memory: 5668kb
input:
2 2 2 1 1 0
output:
detention
result:
ok no solution
Test #10:
score: 37
Accepted
time: 0ms
memory: 4448kb
input:
200 8 2 5 1 4 5 6 7 6 0 2 3 5 6 10 5 1 3 5 6 7 5 1 2 4 6 7 3 0 3 6 4 0 1 2 6 7 0 1 2 3 4 5 7 5 0 2 3 6 10 6 9 10 11 12 13 14 7 8 10 11 12 13 14 15 8 1 7 8 9 11 12 13 14 7 8 9 10 12 13 14 15 4 8 9 10 11 5 8 9 10 11 15 5 8 9 10 11 15 4 9 11 13 14 8 17 18 19 20 21 22 23 35 7 16 18 19 20 21 22 23 6 16 1...
output:
home 26 8 0 2 3 4 5 6 7 1 8 8 9 10 11 12 13 14 15 8 16 17 18 19 20 21 23 22 8 24 26 27 28 29 30 31 25 8 32 33 35 36 37 38 39 34 8 40 41 42 43 44 45 47 46 8 48 50 51 52 53 54 55 49 7 56 57 58 60 61 62 59 8 63 65 66 67 68 69 70 64 8 71 72 73 74 75 76 78 77 8 79 81 82 83 84 85 86 80 8 87 89 ...
result:
ok correct plan!
Test #11:
score: 37
Accepted
time: 1ms
memory: 4296kb
input:
150 5 2 2 1 2 4 0 2 3 6 2 0 1 5 1 4 5 6 7 4 3 5 6 7 4 3 4 6 7 5 1 3 4 5 7 4 3 4 5 6 4 9 10 12 17 5 8 10 11 12 13 3 8 9 12 2 9 12 4 8 9 10 11 4 9 14 15 16 4 13 15 16 17 4 13 14 16 17 4 13 14 15 17 4 8 14 15 16 4 19 20 21 22 5 18 20 21 22 46 4 18 19 21 22 5 18 19 20 22 31 4 18 19 20 21 4 24 25 26 27 3...
output:
home 36 3 1 2 0 5 3 5 6 7 4 5 8 9 11 12 10 5 13 14 15 17 16 5 18 19 20 22 21 5 23 24 25 27 26 1 28 5 29 30 55 57 56 5 31 32 33 35 34 5 36 37 38 40 39 4 41 43 44 42 5 45 47 48 49 46 5 50 51 52 53 54 5 58 59 61 62 60 1 63 1 64 5 65 67 68 69 66 5 70 71 72 74 73 5 75 76 77 78 79 5 80 ...
result:
ok correct plan!
Test #12:
score: 37
Accepted
time: 1ms
memory: 5956kb
input:
250 6 2 5 1 2 3 4 5 3 0 3 4 5 0 3 4 5 17 4 0 1 2 5 4 0 1 2 5 5 0 2 3 4 12 4 7 9 10 11 6 6 8 9 10 11 46 4 7 9 10 11 6 6 7 8 10 11 43 5 6 7 8 9 11 5 6 7 8 9 10 6 5 13 14 15 16 17 5 12 14 15 16 17 4 12 13 15 16 4 12 13 14 17 4 12 13 14 17 5 2 12 13 15 16 5 19 20 21 22 23 5 18 20 21 22 23 5 18 19 21 22 ...
output:
detention
result:
ok no solution
Test #13:
score: 37
Accepted
time: 1ms
memory: 4536kb
input:
250 7 2 6 1 2 3 4 5 6 6 0 2 3 4 5 6 7 0 1 3 4 5 6 7 6 0 1 2 4 5 6 6 0 1 2 3 5 6 6 0 1 2 3 4 6 7 0 1 2 3 4 5 8 2 2 8 2 6 7 4 10 11 12 17 3 9 11 12 4 9 10 12 19 3 9 10 11 5 14 15 17 18 19 6 13 15 16 17 18 19 6 13 14 16 17 18 19 5 14 15 17 18 19 7 9 13 14 15 16 18 19 6 13 14 15 16 17 19 7 11 13 14 15 1...
output:
detention
result:
ok no solution
Test #14:
score: 37
Accepted
time: 0ms
memory: 4248kb
input:
250 5 2 3 1 3 7 3 0 2 3 3 1 3 4 3 0 1 2 1 2 3 6 7 8 5 1 5 7 8 9 4 0 5 6 8 4 5 6 7 9 2 6 8 2 14 25 3 12 13 14 2 11 14 2 11 44 3 10 11 12 5 16 17 18 19 20 3 15 18 19 3 15 18 19 4 15 16 17 28 3 15 16 17 5 15 21 22 23 24 4 20 22 23 24 5 20 21 23 24 36 4 20 21 22 24 4 20 21 22 23 5 10 26 27 28 29 4 25 27...
output:
detention
result:
ok no solution
Test #15:
score: 37
Accepted
time: 0ms
memory: 3924kb
input:
100 5 0 4 1 2 3 4 4 0 2 3 4 3 0 1 4 3 0 1 4 4 0 1 2 3 3 6 7 8 4 5 7 8 9 4 5 6 8 9 4 5 6 7 9 3 6 7 8 3 11 12 14 3 10 12 14 4 10 11 13 14 2 12 14 4 10 11 12 13 2 16 17 2 15 17 2 15 16 4 19 20 21 22 4 18 20 21 22 3 18 19 21 4 18 19 20 22 3 18 19 21 4 24 25 26 27 3 23 26 27 3 23 26 27 4 23 24 25 27 4 23...
output:
home 24 5 0 2 3 4 1 5 5 6 8 9 7 5 10 11 13 14 12 3 15 16 17 5 18 19 20 21 22 5 23 24 25 27 26 5 28 29 31 32 30 5 33 34 35 37 36 5 38 39 40 41 42 5 43 44 46 47 45 5 48 49 50 51 52 5 53 54 55 57 56 5 58 59 60 62 61 4 63 64 65 66 2 67 68 2 69 70 5 71 72 74 75 73 5 76 78 79 80 77 5 81 ...
result:
ok correct plan!
Test #16:
score: 37
Accepted
time: 2ms
memory: 4308kb
input:
250 10 1 9 1 2 3 4 5 6 7 8 9 9 0 2 3 4 5 6 7 8 9 9 0 1 3 4 5 6 7 8 9 9 0 1 2 4 5 6 7 8 9 9 0 1 2 3 5 6 7 8 9 9 0 1 2 3 4 6 7 8 9 9 0 1 2 3 4 5 7 8 9 9 0 1 2 3 4 5 6 8 9 9 0 1 2 3 4 5 6 7 9 10 0 1 2 3 4 5 6 7 8 12 9 11 12 13 14 15 16 17 18 19 9 10 12 13 14 15 16 17 18 19 10 9 10 11 13 14 15 16 17 18 ...
output:
home 28 10 0 1 2 3 4 6 7 8 9 5 10 10 11 12 13 14 15 16 17 19 18 10 20 21 23 24 25 26 27 28 29 22 10 30 31 32 33 34 35 37 38 39 36 9 40 41 42 43 44 45 46 47 48 10 49 50 51 52 54 55 56 57 58 53 10 59 60 61 62 63 64 65 67 68 66 10 69 70 71 72 74 75 76 77 78 73 10 79 80 81 82 83 85 86 87 88 84 ...
result:
ok correct plan!
Subtask #3:
score: 0
Wrong Answer
Dependency #2:
100%
Accepted
Test #17:
score: 12
Accepted
time: 0ms
memory: 3660kb
input:
2 2 2 1 1 0
output:
detention
result:
ok no solution
Test #18:
score: 0
Wrong Answer
time: 4ms
memory: 6856kb
input:
1000 10 0 6 1 2 3 5 6 7 7 0 2 3 4 5 6 7 7 0 1 3 4 5 6 7 7 0 1 2 4 5 6 7 6 1 2 3 5 6 7 7 0 1 2 3 4 6 7 7 0 1 2 3 4 5 7 7 0 1 2 3 4 5 6 9 9 10 11 12 13 14 15 16 17 8 8 10 12 13 14 15 16 17 8 8 9 11 12 13 14 15 17 8 8 10 12 13 14 15 16 17 9 8 9 10 11 13 14 15 16 17 8 8 9 10 11 12 15 16 17 7 8 9 10 11 1...
output:
detention
result:
wrong answer wrong token: expected home, read detention
Subtask #4:
score: 31
Accepted
Test #25:
score: 31
Accepted
time: 0ms
memory: 3752kb
input:
2 2 2 1 1 0
output:
detention
result:
ok no solution
Test #26:
score: 31
Accepted
time: 63ms
memory: 8552kb
input:
1900 6 5 5 2 3 4 5 6 4 2 4 5 7 5 0 1 3 4 5 6 0 2 4 5 6 11 5 0 1 2 3 6 4 0 1 2 3 8 0 3 4 7 8 9 10 11 5 1 6 8 9 11 5 6 7 9 10 11 4 6 7 8 11 3 6 8 11 6 3 6 7 8 9 10 5 13 15 16 17 29 6 12 14 15 16 17 37 4 13 15 16 17 5 12 13 14 16 17 6 12 13 14 15 17 37 7 12 13 14 15 16 24 32 5 19 20 21 22 28 6 18 20 21...
output:
home 593 6 1 2 3 4 5 0 6 6 7 8 9 10 11 6 13 14 15 16 17 12 6 18 19 20 21 23 22 6 25 26 27 28 29 24 6 30 31 32 33 35 34 6 36 37 38 40 41 39 5 42 43 45 46 44 1 47 1 48 1 49 1 50 1 51 1 52 1 53 6 54 55 57 58 59 56 1 60 1 61 6 62 63 64 65 66 67 6 69 70 71 72 73 68 6 74 75 76 77 79 78...
result:
ok correct plan!
Test #27:
score: 31
Accepted
time: 53ms
memory: 8652kb
input:
1800 5 5 4 1 2 6 10 5 0 2 4 9 13 2 0 1 3 4 5 23 4 1 3 7 25 5 3 6 7 8 9 5 0 5 7 8 9 6 4 5 6 8 9 14 4 5 6 7 9 5 1 5 6 7 8 5 0 11 12 13 14 4 10 12 13 14 4 10 11 13 14 7 1 10 11 12 14 17 31 5 7 10 11 12 13 6 16 19 21 24 29 33 1 15 5 13 18 19 20 21 6 17 19 20 21 24 26 5 15 17 18 20 21 4 17 18 19 21 5 15 ...
output:
home 564 1 0 1 1 1 2 1 3 1 4 5 5 7 8 9 6 5 11 12 13 14 10 2 15 16 5 18 19 20 21 17 5 22 23 24 25 26 5 27 28 29 30 31 5 33 34 35 36 32 5 37 38 39 40 41 1 42 1 43 5 44 45 47 48 46 5 49 51 52 53 50 5 54 56 57 58 55 5 59 60 62 63 61 5 64 65 66 68 67 5 69 71 72 73 70 1 74 1 75 1 76...
result:
ok correct plan!
Test #28:
score: 31
Accepted
time: 35ms
memory: 8124kb
input:
1650 6 5 5 1 3 4 5 7 6 0 2 3 4 5 25 4 1 3 4 5 7 0 1 2 4 5 12 28 6 0 1 2 3 5 13 5 0 1 2 3 4 4 7 8 10 11 6 0 6 8 9 10 11 6 6 7 9 10 11 53 4 7 8 10 11 7 6 7 8 9 11 34 52 6 6 7 8 9 10 55 4 3 13 20 22 3 4 12 14 6 13 15 16 17 18 19 7 14 16 17 18 19 26 36 5 14 15 17 18 19 7 14 15 16 18 19 34 46 5 14 15 16 ...
output:
home 403 6 1 2 3 4 5 0 6 6 7 9 10 11 8 1 12 1 13 6 14 16 17 18 19 15 6 20 21 22 23 24 25 6 26 27 28 29 30 31 6 32 33 35 36 37 34 1 38 6 39 40 41 42 44 43 6 45 47 48 49 50 46 6 52 53 54 55 56 51 6 57 58 60 61 62 59 6 63 64 66 67 68 65 6 69 71 72 73 74 70 6 75 76 78 79 80 77 6 81 82 83...
result:
ok correct plan!
Test #29:
score: 31
Accepted
time: 4ms
memory: 7848kb
input:
1050 10 5 3 1 9 10 5 0 3 8 22 270 6 4 5 7 9 10 11 7 1 4 5 6 9 10 11 9 2 3 5 6 7 8 9 10 11 7 2 3 4 6 9 10 11 7 3 4 5 7 8 9 10 7 2 4 6 8 9 10 11 6 1 4 6 7 10 11 9 0 2 3 4 5 6 7 10 11 9 0 2 3 4 5 6 7 8 9 8 2 3 4 5 7 8 9 22 9 13 14 15 16 17 18 19 20 21 10 12 14 15 16 17 18 19 20 21 37 10 12 13 15 16 18 ...
output:
detention
result:
ok no solution
Test #30:
score: 31
Accepted
time: 6ms
memory: 8540kb
input:
1300 7 7 7 2 3 4 5 6 9 32 5 2 3 4 5 6 8 0 1 3 4 5 6 9 12 7 0 1 2 4 5 10 11 6 0 1 2 3 5 6 6 0 1 2 3 4 6 6 0 1 2 4 5 9 5 8 9 11 12 13 5 7 9 10 11 13 9 0 2 6 7 8 10 11 12 13 6 3 8 9 11 12 13 8 3 7 8 9 10 12 13 31 6 2 7 9 10 11 13 6 7 8 9 10 11 12 8 15 16 17 18 19 20 24 32 6 14 16 17 18 19 20 7 14 15 17...
output:
detention
result:
ok no solution
Test #31:
score: 31
Accepted
time: 4ms
memory: 8628kb
input:
1300 9 4 5 2 3 4 6 7 6 3 4 5 6 7 13 7 0 3 4 5 6 7 8 6 0 1 2 4 5 8 8 0 1 2 3 5 6 7 8 8 1 2 3 4 6 7 8 16 8 0 1 2 4 5 7 8 14 8 0 1 2 4 5 6 8 12 6 2 3 4 5 6 7 7 10 11 12 13 14 15 16 6 9 12 13 14 15 16 7 9 12 13 14 15 16 17 9 7 9 10 11 13 14 15 16 17 9 1 9 10 11 12 14 15 16 17 9 6 9 10 11 12 13 15 16 17 ...
output:
detention
result:
ok no solution
Test #32:
score: 31
Accepted
time: 0ms
memory: 9568kb
input:
2000 5 5 5 1 2 3 4 8 4 0 2 3 4 4 0 1 3 4 7 0 1 2 4 10 12 16 4 0 1 2 3 4 6 7 8 9 5 5 8 9 17 29 3 5 8 9 6 0 5 6 7 9 14 5 5 6 7 8 19 5 3 11 12 13 15 3 10 13 18 3 3 10 13 4 1 10 11 12 5 8 15 16 17 18 5 10 14 16 17 18 5 3 14 15 17 18 5 6 14 15 16 18 5 11 14 15 16 17 6 9 20 21 22 23 24 4 19 21 22 23 5 19 ...
output:
detention
result:
ok no solution
Test #33:
score: 31
Accepted
time: 148ms
memory: 10048kb
input:
2500 9 6 6 1 2 3 4 6 7 5 0 2 3 6 7 6 0 1 4 5 6 7 7 0 1 4 7 8 31 35 6 0 2 3 5 6 8 5 2 4 6 7 8 6 0 1 2 4 5 7 8 0 1 2 3 5 6 15 36 5 3 4 5 19 39 7 10 11 13 14 15 16 39 8 9 11 12 13 14 15 16 40 7 9 10 12 13 14 15 16 9 10 11 13 14 15 16 17 22 33 7 9 10 11 12 14 15 17 8 9 10 11 12 13 15 16 17 9 7 9 10 11 1...
output:
home 420 9 1 2 3 4 5 6 7 8 0 9 9 10 11 13 14 15 16 17 12 9 18 19 20 21 22 23 25 26 24 9 27 29 30 31 32 33 34 35 28 6 36 37 38 39 41 40 9 42 43 44 45 46 47 49 50 48 1 51 1 52 1 53 9 54 55 56 57 58 59 61 62 60 1 63 1 64 1 65 1 66 9 67 68 69 71 72 73 74 75 70 9 76 78 79 80 81 82 83 84 77...
result:
ok correct plan!
Test #34:
score: 31
Accepted
time: 21ms
memory: 9972kb
input:
2500 9 6 8 1 2 3 5 7 8 12 16 9 0 2 3 4 5 6 7 8 14 9 0 1 3 4 5 6 7 8 19 8 0 1 2 4 6 7 8 17 8 1 2 3 5 6 7 8 13 7 0 1 2 4 6 7 8 7 1 2 3 4 5 7 8 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 6 10 12 13 15 16 17 7 9 12 13 14 15 16 17 4 13 14 16 17 7 0 9 10 13 14 15 17 8 4 9 10 11 12 15 16 17 7 1 10 11 12 15 16 17 7 9 ...
output:
detention
result:
ok no solution