QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#378279 | #5450. 比赛 | zhouhuanyi | 18 | 26ms | 6332kb | C++14 | 2.0kb | 2024-04-06 10:44:07 | 2024-04-06 10:44:08 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cstdlib>
#include<random>
#include<algorithm>
#define N 2000
using namespace std;
mt19937 RAND(random_device{}());
int read()
{
char c=0;
int sum=0;
while (c<'0'||c>'9') c=getchar();
while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
return sum;
}
int T,n,m,p[N+1],cl[N+1][N+1],rcnt[N+1],cnt[N+1],scnt[N+1],tong[N+1],length;
bool used[N+1];
bitset<N+1>B[N+1];
bitset<N+1>st;
vector<int>E[N+1];
bool check(int x,int y,int z)
{
return !cl[x][y]||!cl[y][z]||cl[x][y]!=cl[y][z];
}
int main()
{
int t,x,res;
bool op;
T=read();
for (int qt=1;qt<=T;++qt)
{
n=read(),m=read(),op=1;
for (int i=1;i<=n;++i) B[i].reset();
for (int i=1;i<=m;++i)
{
rcnt[i]=t=read(),op&=(t*3<=(n<<1)),E[i].clear();
while (t--) x=read(),B[x][i]=1,E[i].push_back(x);
}
if (!op)
{
puts("-1");
continue;
}
for (int i=1;i<=n;++i)
for (int j=i+1;j<=n;++j)
{
st=B[i]&B[j];
if (!st.any()) cl[i][j]=cl[j][i]=0;
else cl[i][j]=cl[j][i]=st._Find_first();
}
while (1)
{
op=1;
for (int i=1;i<=m;++i) cnt[i]=rcnt[i];
for (int i=1;i<=n;++i) used[i]=0;
for (int i=1;i<=n;++i)
{
res=length=0;
for (int j=1;j<=m;++j) res=max(res,cnt[j]);
for (int j=1;j<=n;++j) scnt[j]=0;
for (int j=1;j<=m;++j)
if (res==cnt[j])
{
for (int k=0;k<E[j].size();++k) scnt[E[j][k]]++;
}
res=length=0;
for (int j=1;j<=n;++j)
if (!used[j]&&(i<=2||check(p[i-2],p[i-1],j)))
{
if (RAND()&1) res=max(res,scnt[j]);
}
for (int j=1;j<=n;++j)
if (res>=scnt[j]&&!used[j]&&(i<=2||check(p[i-2],p[i-1],j)))
tong[++length]=j;
if (!length)
{
op=0;
break;
}
p[i]=tong[RAND()%length+1],used[p[i]]=1;
for (int j=1;j<=m;++j)
if (B[p[i]][j])
cnt[j]--;
}
if (op&&check(p[n],p[1],p[2])&&check(p[n-1],p[n],p[1])) break;
}
for (int i=1;i<=n;++i) printf("%d ",p[i]);
puts("");
}
return 0;
}
详细
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 2ms
memory: 5904kb
input:
248 9 3 3 3 4 5 3 1 2 3 4 6 7 8 9 8 1 4 3 4 5 6 9 2 5 1 2 3 4 5 3 6 7 8 6 1 4 3 4 5 6 7 2 3 3 4 5 3 1 2 3 9 3 4 1 2 3 4 3 4 5 6 3 6 7 8 7 1 4 4 5 6 7 8 2 3 6 7 8 3 2 3 4 8 2 4 1 2 3 4 4 4 5 6 7 3 0 9 3 3 2 3 4 3 7 8 9 3 4 5 6 6 1 5 1 2 3 4 5 9 2 4 1 2 3 4 3 6 7 8 9 3 3 6 7 8 3 3 4 5 3 1 2 3 8 1 8 1 ...
output:
7 4 6 9 2 5 3 8 1 8 4 1 5 6 7 3 2 3 5 6 1 4 9 2 7 8 2 4 5 1 3 6 1 6 5 7 3 2 4 1 3 8 2 4 5 9 6 7 3 6 1 5 7 2 4 2 8 5 3 7 4 6 1 7 5 3 8 2 4 6 1 3 2 1 3 7 2 1 5 8 9 6 4 -1 6 9 8 7 3 1 5 4 2 8 7 4 9 2 6 1 5 3 -1 -1 5 1 4 3 2 6 7 8 7 2 4 5 1 6 3 9 8 8 5 2 1 6 3 7 4 2 5 8 1 7 4 3 6 9 3 1 ...
result:
ok 248 testcases
Test #2:
score: 0
Accepted
time: 3ms
memory: 5836kb
input:
180 6 3 3 1 2 3 3 3 4 5 3 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 3 1 3 2 1 -1 7 6 4 1 5 2 3 8 ...
result:
ok 339 testcases
Test #7:
score: 0
Accepted
time: 3ms
memory: 5900kb
input:
336 8 5 3 8 4 7 3 2 4 3 4 1 8 5 3 3 6 5 4 4 6 2 1 7 3 1 3 1 2 3 4 1 3 2 1 3 9 4 3 8 4 3 6 1 7 6 2 4 5 3 3 9 1 3 9 8 6 7 4 4 4 6 7 3 3 1 7 5 3 5 6 2 3 4 2 1 4 0 3 1 3 3 2 1 8 2 4 6 3 5 4 5 3 8 2 1 7 3 0 7 4 3 5 3 1 3 4 1 7 4 6 4 2 5 3 7 6 3 7 4 4 5 4 2 3 3 6 7 4 3 7 2 1 3 6 1 5 4 0 7 4 3 5 4 2 4 7 2 ...
output:
8 5 4 2 7 3 1 6 -1 -1 6 8 1 2 3 4 7 9 5 2 3 4 5 7 6 1 2 3 4 1 -1 3 5 2 1 4 7 6 8 2 3 1 1 7 5 6 3 4 2 3 6 2 4 7 5 1 2 4 3 1 4 3 7 1 2 6 5 -1 4 5 6 2 1 3 -1 2 1 6 5 4 3 4 2 3 5 6 1 3 1 6 4 2 5 -1 5 4 2 3 1 7 6 6 3 4 2 9 7 1 5 8 3 9 7 8 4 1 5 6 2 3 1 2 3 2 4 5 1 6 4 5 3 1 8 7 2 7 9 ...
result:
ok 336 testcases
Subtask #2:
score: 6
Accepted
Dependency #1:
100%
Accepted
Test #8:
score: 6
Accepted
time: 1ms
memory: 3912kb
input:
2 12 3 7 1 3 4 8 9 11 12 3 1 5 6 3 6 7 12 15 1 10 1 2 3 4 5 6 7 8 9 10
output:
2 4 10 6 3 8 5 12 11 7 9 1 4 1 11 5 6 13 10 9 12 2 7 15 8 3 14
result:
ok 2 testcases
Test #9:
score: 0
Accepted
time: 5ms
memory: 3804kb
input:
231 6 3 3 1 4 6 3 6 5 2 3 1 3 2 11 2 5 9 2 8 1 6 7 10 7 5 4 3 8 11 4 1 4 2 3 4 1 9 2 7 7 1 6 4 2 3 9 3 8 5 4 6 1 3 3 1 4 4 1 3 2 3 1 8 2 3 8 3 7 3 1 8 6 13 2 6 13 5 10 7 4 9 8 12 2 4 8 6 3 11 1 4 1 3 1 4 2 5 1 4 1 3 4 5 12 10 4 10 5 1 8 3 4 10 7 3 12 10 9 3 4 9 11 4 1 9 3 7 3 4 6 1 6 6 5 11 2 7 12 4...
output:
5 2 4 6 3 1 6 10 2 5 8 1 3 4 9 11 7 -1 -1 5 4 3 2 6 1 -1 6 3 4 5 1 7 2 8 3 11 9 1 12 13 6 7 4 2 10 8 5 -1 -1 1 9 6 4 2 11 10 7 8 3 5 12 7 9 4 11 5 10 8 1 6 3 2 8 3 5 11 7 4 9 1 6 10 2 7 2 11 5 6 1 9 12 8 10 4 3 4 2 5 1 6 3 8 1 7 5 3 2 9 6 4 -1 -1 -1 9 10 3 13 15 2 8 4 5 14 12 1 6 11 7 -1...
result:
ok 231 testcases
Test #10:
score: 0
Accepted
time: 5ms
memory: 6072kb
input:
219 4 1 3 3 1 2 4 1 3 3 2 1 7 2 4 4 2 1 5 3 7 3 6 7 4 4 4 1 3 2 3 7 6 1 3 7 4 5 3 2 5 6 7 4 3 4 6 1 4 6 3 5 7 3 4 2 3 3 1 2 7 15 8 3 6 12 14 3 15 14 2 3 7 10 14 3 8 14 11 8 6 1 5 9 11 3 10 15 3 14 9 4 7 4 12 13 8 7 2 1 3 13 14 5 9 2 3 5 9 3 6 6 4 8 1 3 7 9 5 4 2 7 6 3 5 7 1 8 4 9 3 9 5 6 3 5 1 2 3 4...
output:
-1 -1 7 6 5 1 3 2 4 5 2 3 6 4 1 7 2 3 5 1 7 4 6 9 13 6 5 8 10 4 3 1 14 12 11 7 15 2 9 1 7 5 3 4 2 8 6 6 4 3 1 7 5 2 9 8 -1 -1 14 11 10 6 7 2 9 8 13 4 5 1 3 15 12 7 10 9 3 2 1 8 6 4 11 5 10 12 5 9 8 1 6 11 7 2 3 4 5 3 2 6 4 1 6 5 10 7 2 8 11 9 4 3 1 5 3 1 4 2 11 9 2 3 6 7 12 4 1 8 10 5 7...
result:
ok 219 testcases
Test #11:
score: 0
Accepted
time: 5ms
memory: 3840kb
input:
213 8 4 3 4 7 3 5 4 1 2 6 5 3 7 8 5 3 6 3 8 4 1 3 4 1 2 6 1 3 2 3 1 5 0 9 7 3 9 1 5 3 7 2 9 3 2 8 1 3 8 3 9 3 4 5 8 5 6 3 4 1 7 3 3 2 5 14 9 3 11 12 5 8 1 5 9 10 14 6 8 2 3 3 1 7 5 3 8 4 11 13 3 11 10 7 3 10 13 12 3 7 14 13 3 14 12 3 4 12 4 9 7 11 2 5 5 3 7 10 11 7 9 1 8 2 6 5 4 11 2 6 5 10 1 7 6 3 ...
output:
2 5 7 4 6 3 1 8 -1 4 3 1 5 2 6 4 5 2 1 3 2 1 6 5 9 4 3 8 7 2 14 4 9 1 7 11 6 8 3 10 5 12 13 10 2 1 7 8 11 5 6 3 9 4 2 8 5 6 4 1 3 11 10 9 7 2 3 1 6 9 4 2 10 3 7 5 8 1 6 13 10 4 5 14 8 7 1 11 3 15 9 2 12 3 2 5 9 6 7 8 4 1 4 8 9 1 13 5 11 3 14 12 15 2 10 7 6 4 8 9 2 1 5 3 6 7 8 3 6 2 7 5 ...
result:
ok 213 testcases
Test #12:
score: 0
Accepted
time: 6ms
memory: 4140kb
input:
226 13 7 6 10 7 5 9 1 8 3 11 13 9 3 5 12 13 3 13 7 4 3 13 6 1 3 13 8 3 7 10 4 12 6 2 11 3 5 1 4 1 3 4 5 5 1 3 3 4 2 13 9 4 3 8 1 7 3 13 8 9 3 7 13 4 3 8 5 11 3 10 5 7 3 12 6 7 3 8 10 12 5 13 5 2 1 12 7 3 11 9 4 6 10 2 6 4 3 5 2 1 3 3 6 5 3 4 1 3 3 4 6 2 14 11 3 14 1 10 4 5 14 2 6 3 2 9 7 3 4 7 14 7 ...
output:
2 12 5 4 3 9 1 11 8 6 10 13 7 -1 1 3 5 4 2 13 7 11 2 12 3 8 4 1 6 9 5 10 5 4 3 2 6 1 12 13 14 11 9 7 10 4 3 2 6 8 5 1 -1 1 3 2 3 6 5 8 2 1 4 7 4 3 6 10 8 2 1 5 7 9 4 5 2 3 6 1 4 9 3 7 5 12 6 11 8 10 1 2 15 3 11 7 10 14 12 2 8 1 6 5 4 13 9 2 10 8 13 14 12 5 6 7 4 1 3 11 9 -1 4 5 6 2 3 1 ...
result:
ok 226 testcases
Test #13:
score: 0
Accepted
time: 5ms
memory: 3932kb
input:
233 9 3 3 9 3 2 3 1 8 3 4 5 6 4 1 8 2 4 3 1 2 7 5 5 1 6 8 4 3 0 15 17 3 10 4 5 3 13 5 15 6 9 7 8 15 10 2 3 6 15 11 4 13 14 9 12 3 9 5 11 5 8 1 4 13 11 3 11 10 14 3 2 12 11 3 4 15 14 3 8 12 5 4 7 4 6 12 6 3 14 1 5 2 6 3 7 11 3 3 4 9 3 3 13 10 3 3 12 15 1 14 9 3 1 2 4 3 4 10 9 3 5 11 2 8 14 1 7 6 8 12...
output:
9 2 8 1 6 3 5 7 4 2 8 1 7 6 3 4 5 2 1 3 12 5 6 7 10 11 3 14 15 8 4 2 13 1 9 6 5 9 7 8 11 3 2 10 1 13 12 14 4 2 3 1 1 6 4 8 5 11 3 10 12 9 2 7 -1 -1 6 4 5 1 2 9 3 8 7 4 2 1 7 3 5 6 5 10 1 2 12 4 13 9 7 3 11 8 6 5 3 2 1 4 -1 1 12 7 4 5 9 8 3 10 2 11 6 11 13 6 5 10 7 1 9 4 3 12 8 2 3 5 1 2...
result:
ok 233 testcases
Test #14:
score: 0
Accepted
time: 5ms
memory: 3800kb
input:
218 3 1 3 1 2 3 10 5 3 8 9 10 3 2 7 10 6 6 8 1 5 2 3 4 4 9 5 7 3 4 10 6 11 2 8 1 10 5 3 4 2 8 7 4 9 11 6 1 3 1 3 2 1 3 9 5 4 5 7 1 8 3 7 6 9 3 9 5 3 5 1 3 4 6 2 3 9 8 2 8 2 4 3 4 6 7 5 3 2 8 5 1 8 5 3 2 4 6 3 4 1 7 4 7 6 8 5 3 5 4 3 4 8 2 1 3 12 2 6 3 9 4 2 7 12 7 5 7 11 6 8 1 10 10 2 3 9 3 6 4 10 2...
output:
-1 7 2 3 9 10 6 8 4 5 1 -1 -1 5 2 9 1 6 8 3 4 7 8 1 6 5 3 7 2 4 7 4 2 8 6 1 5 3 12 10 11 2 3 8 4 7 6 9 5 1 9 4 6 1 8 7 10 5 2 3 8 4 6 5 11 10 9 2 12 3 1 7 1 8 2 15 9 14 3 4 11 10 6 12 13 7 5 -1 10 8 3 4 1 5 2 6 9 7 5 6 7 2 4 3 1 1 4 6 2 5 3 7 8 4 2 5 6 1 3 7 2 3 7 4 8 1 5 6 9 3 6 7 8 4 ...
result:
ok 218 testcases
Test #15:
score: 0
Accepted
time: 5ms
memory: 6052kb
input:
222 4 0 10 1 6 10 7 6 4 3 5 11 2 5 1 5 4 6 8 7 11 1 7 2 10 9 3 6 1 5 3 4 6 1 2 7 7 3 1 5 4 3 5 7 3 3 1 6 3 3 2 6 5 3 3 2 4 3 7 1 2 3 6 7 4 15 12 3 13 2 12 4 13 4 14 11 4 8 6 4 2 3 10 12 4 4 9 1 10 13 3 4 1 3 3 13 6 5 4 10 3 2 14 3 1 7 2 8 3 15 5 8 7 12 11 9 3 10 11 6 4 14 12 6 1 7 4 3 5 6 7 3 3 2 5 ...
output:
2 3 4 1 5 9 7 3 8 10 4 2 1 6 5 7 1 4 2 3 8 10 11 6 9 -1 6 2 4 5 3 1 7 12 5 4 10 15 7 13 1 3 14 9 2 11 8 6 6 3 4 2 5 1 7 2 6 8 5 4 1 3 7 3 1 2 2 1 6 5 4 3 7 8 13 10 1 15 4 5 3 14 9 6 2 11 12 4 1 6 7 8 5 3 2 5 4 3 1 2 4 3 1 2 5 2 6 8 7 5 3 4 1 8 3 5 1 10 4 6 2 9 11 7 5 3 2 4 1 7 3 8 4 ...
result:
ok 222 testcases
Test #16:
score: 0
Accepted
time: 2ms
memory: 3852kb
input:
228 6 1 5 5 3 4 2 1 5 1 4 4 5 3 2 10 2 6 6 7 4 10 5 3 5 2 4 9 8 1 6 4 3 2 4 3 3 5 3 1 3 1 4 6 3 6 2 5 9 2 3 7 4 6 3 5 7 9 9 6 4 1 5 6 3 3 7 4 6 4 7 8 9 2 3 1 4 2 3 9 3 4 3 4 8 5 7 2 4 6 5 7 1 4 5 4 3 2 15 11 4 2 1 8 11 3 1 10 14 3 7 5 1 3 1 13 6 6 6 15 7 4 2 14 3 11 5 14 3 10 11 15 3 9 6 11 3 7 11 1...
output:
-1 -1 7 8 10 6 9 4 3 1 2 5 4 5 2 1 3 6 6 4 2 5 1 7 9 8 3 4 6 2 8 3 7 9 5 1 4 5 1 2 3 6 7 1 5 13 6 15 11 14 4 12 7 8 10 2 3 9 -1 15 10 13 3 14 12 1 8 11 7 6 9 4 5 2 2 1 3 9 13 2 8 1 10 5 12 11 14 6 4 3 7 10 9 8 2 4 1 6 7 5 3 5 6 3 2 7 8 1 4 6 2 7 3 9 1 4 8 5 1 2 6 3 4 5 7 9 13 12 4 11 8 ...
result:
ok 228 testcases
Subtask #3:
score: 6
Accepted
Dependency #1:
100%
Accepted
Test #17:
score: 6
Accepted
time: 7ms
memory: 5968kb
input:
66 43 106 3 42 1 38 4 3 16 13 39 3 42 37 8 3 5 2 37 3 35 40 19 4 8 10 6 12 3 2 42 32 3 8 28 5 3 37 11 31 3 35 1 30 3 12 24 26 5 13 1 5 12 36 3 24 37 43 4 16 34 20 17 3 34 30 2 3 16 1 10 3 20 3 19 3 28 31 35 3 2 27 3 4 36 16 24 30 3 7 4 24 3 41 14 31 3 23 14 16 4 36 26 17 42 3 29 37 3 3 1 40 3 3 20 2...
output:
43 8 5 40 41 21 19 31 38 23 29 18 12 25 39 15 2 24 13 6 17 32 1 3 42 28 35 34 20 4 11 14 30 16 26 9 22 33 37 36 27 7 10 19 2 17 5 21 10 15 13 4 12 1 3 14 6 16 7 18 8 9 11 20 23 22 17 13 21 3 11 23 25 8 14 9 2 10 20 19 6 22 24 4 16 1 18 12 15 7 5 28 19 32 25 3 9 1 15 5 16 24 8 29 10 6 34 27 12 13 ...
result:
ok 66 testcases
Test #18:
score: 0
Accepted
time: 8ms
memory: 6200kb
input:
57 33 60 3 21 20 19 3 17 25 30 3 20 33 16 4 21 23 24 29 3 13 26 15 3 27 7 15 3 4 30 20 3 5 16 13 3 1 11 16 3 31 13 9 3 12 26 17 3 10 26 20 3 5 25 31 3 27 2 24 3 8 7 21 3 18 24 17 3 27 10 8 4 27 32 3 16 3 20 14 31 3 17 13 27 3 12 5 24 4 12 6 21 16 3 16 19 9 3 24 20 25 3 9 24 14 3 9 23 26 11 32 5 17 2...
output:
31 32 9 12 22 30 3 21 28 33 6 1 16 13 4 11 7 26 23 8 10 24 14 29 19 17 5 25 20 18 2 27 15 22 36 6 34 27 4 24 8 3 13 9 16 10 32 35 42 23 17 21 44 26 33 15 14 39 28 25 11 43 20 31 12 40 5 38 29 1 30 45 7 41 18 37 19 2 16 29 14 10 34 30 11 31 27 6 36 7 8 15 12 33 17 22 2 37 24 26 23 21 18 19 1 4 13 3...
result:
ok 57 testcases
Test #19:
score: 0
Accepted
time: 11ms
memory: 3952kb
input:
65 17 17 3 6 17 14 4 17 9 16 7 4 5 17 4 3 4 15 11 8 17 3 11 4 14 5 11 7 3 1 12 3 3 16 8 3 8 5 12 3 3 15 13 3 3 2 14 8 13 2 10 1 9 8 4 6 3 4 7 15 4 14 5 13 7 3 17 2 12 4 2 16 11 5 3 9 15 5 5 16 14 12 15 10 26 21 7 23 10 25 9 7 3 21 3 15 9 20 3 20 25 13 3 14 21 5 3 14 15 23 16 12 6 10 2 15 17 8 24 5 1...
output:
3 10 8 17 9 14 4 15 16 1 7 2 12 11 5 6 13 23 22 14 26 11 21 24 8 16 13 10 20 12 2 18 1 6 7 4 3 9 17 19 25 5 15 14 4 2 8 3 20 6 11 21 15 9 10 17 1 7 16 13 5 19 18 12 16 19 13 14 15 9 23 20 18 1 4 11 3 12 17 6 7 21 10 8 2 5 22 3 23 25 14 21 10 13 18 8 5 12 6 4 2 19 22 17 9 16 1 15 7 20 11 24 7 11...
result:
ok 65 testcases
Test #20:
score: 0
Accepted
time: 12ms
memory: 6024kb
input:
65 26 43 3 6 5 22 3 1 4 26 3 7 14 26 3 19 2 24 3 10 19 13 3 9 7 19 3 21 22 1 3 22 20 24 3 9 2 17 3 4 20 15 10 20 23 2 6 13 8 12 7 25 1 3 22 11 23 3 2 18 22 3 19 12 5 3 3 17 12 3 10 20 14 3 4 10 2 3 1 14 3 3 23 14 5 3 4 7 11 3 15 1 19 3 15 6 17 3 26 12 22 3 17 23 26 3 21 20 17 3 4 9 6 3 11 14 2 3 24 ...
output:
3 10 20 4 8 14 9 16 17 12 5 2 21 18 13 23 22 15 1 25 11 26 6 24 7 19 3 23 27 9 30 5 24 19 13 16 7 12 6 8 10 22 28 26 17 18 1 15 14 2 11 21 4 25 20 29 1 4 12 8 15 9 2 11 13 3 16 10 7 5 14 6 35 1 25 29 42 39 31 44 7 11 19 28 18 43 20 14 30 27 3 24 26 5 17 9 4 22 32 12 38 15 16 33 10 37 41 2 13 8 23...
result:
ok 65 testcases
Test #21:
score: 0
Accepted
time: 26ms
memory: 6332kb
input:
63 41 101 3 7 25 14 3 5 39 22 3 22 38 32 3 19 8 12 3 19 23 32 3 2 40 16 4 22 24 9 16 3 20 6 10 3 6 27 21 3 22 11 21 3 2 30 8 3 35 16 20 3 33 9 26 4 21 41 35 18 4 33 18 4 16 3 21 34 5 5 1 18 22 10 8 3 31 7 33 4 9 21 23 38 3 1 25 16 3 29 3 32 3 2 32 20 4 35 25 39 8 3 36 30 32 3 33 21 40 3 9 41 6 3 38 ...
output:
16 25 12 10 23 37 36 29 5 24 41 2 31 35 4 8 26 21 7 19 38 27 14 20 22 33 3 34 28 11 6 32 17 18 15 1 9 30 39 40 13 26 9 19 7 20 4 28 11 1 25 5 12 6 16 14 8 24 21 2 27 3 23 17 30 29 15 22 13 10 18 27 24 4 14 10 15 17 7 2 26 30 19 6 29 12 18 13 31 11 25 16 23 20 9 8 3 28 21 22 1 5 16 6 12 4 14 2 11 ...
result:
ok 63 testcases
Test #22:
score: 0
Accepted
time: 10ms
memory: 4084kb
input:
65 17 19 8 5 2 11 14 7 1 12 17 3 11 8 15 6 4 16 8 17 3 10 6 15 3 6 9 14 13 3 11 9 4 3 1 16 9 3 12 10 9 3 5 10 15 3 4 12 6 3 9 7 8 3 6 16 11 3 13 4 5 3 7 13 16 3 15 12 16 3 7 10 6 3 5 8 6 3 1 13 8 3 13 11 10 3 1 15 4 17 21 7 11 6 15 2 16 10 7 4 12 8 7 9 4 12 3 13 15 3 1 4 7 4 13 8 16 17 3 3 17 7 3 12...
output:
2 16 10 14 3 5 15 6 17 4 1 12 13 7 11 8 9 7 1 11 4 5 3 6 12 13 10 17 16 2 14 9 15 8 33 29 27 10 5 9 28 1 38 3 32 14 36 21 16 12 19 2 11 17 15 8 23 7 20 35 37 18 30 4 26 6 22 31 13 24 25 34 9 21 15 14 23 19 5 1 6 3 17 22 13 10 11 18 4 20 16 8 12 2 7 15 13 19 23 20 12 9 24 5 18 1 21 11 3 2 4 7 8 1...
result:
ok 65 testcases
Test #23:
score: 0
Accepted
time: 17ms
memory: 4012kb
input:
68 32 57 3 15 17 27 3 26 3 19 3 25 4 13 3 4 16 1 3 16 30 25 3 31 10 1 3 17 22 10 3 22 30 29 3 5 32 27 3 29 6 32 3 1 28 5 3 25 8 5 3 24 5 3 3 25 2 10 3 32 22 16 3 11 9 3 3 19 17 1 3 10 23 3 3 23 15 22 3 2 16 6 3 30 6 9 3 24 1 13 3 27 24 29 3 1 9 8 17 31 7 26 17 21 2 24 11 28 14 30 4 18 8 20 32 23 3 2...
output:
25 31 13 10 21 20 3 9 1 24 4 22 12 18 11 5 7 29 14 26 6 28 32 16 30 19 17 2 27 15 8 23 12 11 21 8 20 4 13 5 25 16 15 10 19 7 9 18 2 1 22 17 23 6 3 14 24 17 8 1 5 27 7 13 21 29 4 2 20 22 25 14 28 10 19 12 23 11 16 9 6 3 15 26 24 18 16 7 11 10 13 14 2 8 12 4 15 6 1 5 3 9 26 13 38 27 28 20 21 36 18...
result:
ok 68 testcases
Test #24:
score: 0
Accepted
time: 10ms
memory: 5836kb
input:
67 26 37 3 9 24 16 3 20 5 16 4 12 14 3 11 4 18 15 9 23 6 19 2 10 16 12 18 3 8 15 3 5 21 7 18 6 11 4 17 7 15 19 3 20 21 15 4 1 25 12 7 5 2 11 22 15 5 3 9 22 12 3 12 24 21 3 1 16 21 3 7 10 8 3 25 17 2 3 11 4 19 4 13 16 14 7 3 12 6 5 3 25 11 13 4 8 11 17 16 8 26 19 8 21 14 25 5 9 4 2 7 20 9 3 7 5 23 3 ...
output:
11 6 23 8 18 19 26 24 5 1 17 16 14 25 13 4 7 21 2 22 10 12 3 20 9 15 14 7 2 16 1 4 13 12 15 10 11 6 5 9 3 8 18 17 12 21 7 25 6 20 10 8 22 24 26 28 2 16 9 13 27 23 1 15 11 4 19 5 3 14 17 14 12 6 13 24 26 1 9 33 3 22 7 11 31 30 32 34 28 8 2 29 19 10 5 16 21 25 20 18 27 4 15 23 30 8 1 2 26 7 19 16 ...
result:
ok 67 testcases
Subtask #4:
score: 0
Time Limit Exceeded
Test #25:
score: 0
Time Limit Exceeded
input:
5 400 1 266 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
output:
result:
Subtask #5:
score: 0
Time Limit Exceeded
Test #36:
score: 0
Time Limit Exceeded
input:
5 400 1 266 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%
Subtask #7:
score: 0
Skipped
Dependency #4:
0%
Subtask #8:
score: 0
Skipped
Dependency #5:
0%
Subtask #9:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%