QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#433403 | #8759. 小班课 | Kevin5307 | AC ✓ | 231ms | 16152kb | C++23 | 4.1kb | 2024-06-08 10:52:42 | 2024-06-08 10:52:43 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
class MinCostMaxFlow
{
private:
struct edge
{
int u,v,capa,cost;
edge(int _u,int _v,int _capa,int _cost)
{
u=_u;
v=_v;
capa=_capa;
cost=_cost;
}
edge(){}
}E[5005000];
vector<int> G[1010];
int p;
int dist[1010];
bool inque[1010];
bool vis[1010];
bool spfa(int s,int t)
{
memset(dist,inf,sizeof(dist));
memset(inque,0,sizeof(inque));
dist[s]=0;
inque[s]=1;
queue<int> q;
q.push(s);
while(!q.empty())
{
int x=q.front();
q.pop();
inque[x]=0;
for(auto e:G[x])
if(E[e].capa&&dist[x]+E[e].cost<dist[E[e].v])
{
dist[E[e].v]=dist[x]+E[e].cost;
if(!inque[E[e].v])
{
q.push(E[e].v);
inque[E[e].v]=1;
}
}
}
return dist[t]<inf;
}
int cost;
int dfs(int u,int t,int flow)
{
if(u==t)
return flow;
vis[u]=1;
int ans=0;
for(auto e:G[u])
if(!vis[E[e].v]&&E[e].capa&&dist[E[e].v]==dist[u]+E[e].cost)
{
int augflow=dfs(E[e].v,t,min(E[e].capa,flow-ans));
if(augflow)
{
cost+=augflow*E[e].cost;
E[e].capa-=augflow;
E[e^1].capa+=augflow;
ans+=augflow;
}
}
vis[u]=0;
return ans;
}
public:
void clear()
{
p=0;
for(int i=0;i<1010;i++)
G[i].clear();
memset(vis,0,sizeof(vis));
}
MinCostMaxFlow()
{
clear();
}
void addEdge(int u,int v,int capa,int cost)
{
G[u].pb(p);
E[p++]=edge(u,v,capa,cost);
G[v].pb(p);
E[p++]=edge(v,u,0,-cost);
}
pii mcmf(int s,int t)
{
cost=0;
int ans=0;
while(spfa(s,t))
{
int x;
while((x=dfs(s,t,inf))) ans+=x;
}
return mp(ans,cost);
}
vector<int> get(int n,int m)
{
vector<int> res(n,inf);
for(int i=1;i<=n;i++)
for(auto e:G[i+m])
if(E[e].v<=m&&E[e].capa)
res[i-1]=-E[e].cost;
return res;
}
}mcmf;
int cnt[505];
vector<int> order[505];
vector<int> G[505];
vector<int> belong[505];
int indeg[505];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--)
{
mcmf.clear();
int n,m;
cin>>n>>m;
for(int i=1;i<=m;i++)
{
int x;
cin>>x;
cnt[i]=x;
mcmf.addEdge(0,i,x,0);
}
for(int i=1;i<=n;i++)
{
order[i].clear();
int c;
cin>>c;
for(int j=1;j<=c;j++)
{
int v;
cin>>v;
order[i].pb(v);
mcmf.addEdge(v,i+m,1,j);
}
mcmf.addEdge(i+m,n+m+1,1,0);
}
pii pr=mcmf.mcmf(0,n+m+1);
vector<int> val=mcmf.get(n,m);
for(int i=1;i<=m;i++)
belong[i].clear();
for(int i=0;i<n;i++)
if(val[i]<=m)
belong[order[i+1][val[i]-1]].pb(i+1);
for(int i=1;i<=n;i++)
G[i].clear();
for(int i=1;i<=n;i++)
if(val[i-1]<=m)
for(int j=0;j<val[i-1]-1;j++)
for(auto x:belong[order[i][j]])
{
G[x].pb(i);
indeg[i]++;
}
queue<int> q;
vector<int> ord;
for(int i=1;i<=n;i++)
if(!indeg[i])
q.push(i);
while(!q.empty())
{
int x=q.front();
q.pop();
ord.pb(x);
for(auto y:G[x])
{
indeg[y]--;
if(!indeg[y])
q.push(y);
}
}
int ans=0;
for(auto ind:ord)
{
int p=0;
while(p<sz(order[ind])&&!cnt[order[ind][p]]) p++;
if(p<sz(order[ind]))
{
ans++;
cnt[order[ind][p]]--;
}
}
cout<<ans<<'\n';
for(auto ind:ord)
cout<<ind<<" ";
cout<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
3 5 5 1 1 1 1 1 4 1 3 2 4 1 5 4 3 4 2 1 2 3 5 1 1 5 3 1 2 2 2 1 2 2 1 2 2 1 3 2 1 3 2 1 3 5 5 1 1 1 1 1 2 1 2 2 5 4 2 3 2 2 4 3 2 5 1
output:
5 2 4 5 3 1 5 5 1 2 3 4 5 2 3 4 5 1
result:
ok Correct!
Test #2:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
250 2 1 2 1 1 1 1 1 1 1 0 2 2 1 1 1 1 2 2 1 2 2 0 2 2 1 2 1 2 1 1 1 1 1 1 2 1 0 0 1 2 1 0 0 2 1 2 1 1 0 1 2 1 0 0 2 1 2 1 1 1 1 1 1 1 1 1 1 2 1 0 1 2 2 2 2 0 1 1 1 2 1 1 1 0 1 1 1 0 1 2 0 1 1 1 2 2 1 1 1 1 2 1 2 2 2 1 1 2 2 1 2 2 1 1 2 0 1 1 2 2 1 2 1 1 0 2 2 2 0 1 1 1 2 1 1 1 1 1 2 1 2 0 1 1 1 1 1 ...
output:
2 1 2 0 1 2 1 2 2 1 2 1 1 0 1 0 1 1 1 2 0 1 2 1 2 1 1 0 1 1 1 2 0 1 0 1 0 1 2 1 2 2 2 1 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 2 0 1 2 1 1 1 1 0 1 1 1 2 1 2 0 1 0 1 1 1 2 2 1 2 0 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1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 2 4 1 2 1 2 3 7 1 37 21 3 13 43 22 0 10 23 46 22 40 12 19 47 27 16 42 4 29 19 45 35 10 6 26 2 43 41 7 9 16 42 44 5 39 40 34 46 14 3 34 3 38 8 10 5 38 23 19 37 9 34 0 5 31 29 15 13 35 3 40 4 28 1 7 6 29 12 9 35 2...
output:
33 1 2 7 9 11 12 14 15 16 17 19 20 21 22 23 26 27 28 29 30 31 32 33 37 38 39 41 42 43 45 6 40 25 5 44 10 35 8 36 4 13 24 3 18 34 39 3 4 8 10 12 13 14 15 16 17 19 20 22 25 27 28 30 32 35 37 40 43 44 45 18 31 7 33 24 38 9 21 42 36 2 11 34 5 26 1 41 6 23 39 29 36 1 3 4 7 8 9 10 12 13 14 16 17 20 21 2...
result:
ok Correct!
Test #7:
score: 0
Accepted
time: 11ms
memory: 4624kb
input:
1 499 497 1 2 0 2 0 1 0 0 0 2 1 2 0 3 1 2 0 0 0 1 0 1 0 2 1 0 1 0 1 1 1 2 0 1 0 1 0 2 2 3 1 1 2 1 0 0 1 0 2 3 0 1 0 0 2 0 1 2 1 0 0 1 2 0 0 2 0 2 0 1 0 1 0 0 1 0 0 1 1 1 1 1 0 0 0 1 2 3 0 0 0 4 2 2 1 2 2 0 1 0 1 0 2 0 1 0 2 0 0 1 1 1 3 2 0 2 2 2 0 1 1 1 1 1 0 1 0 1 1 1 1 1 2 0 0 1 0 2 1 2 1 2 1 0 1 ...
output:
482 3 4 5 6 10 11 12 14 15 16 17 18 21 22 23 27 28 30 31 33 34 38 39 40 41 42 43 47 48 49 51 53 55 56 58 59 60 61 63 64 69 70 73 75 76 81 82 85 86 87 88 89 90 91 92 94 95 96 101 103 104 106 108 110 111 112 113 117 118 119 120 122 123 124 125 126 134 136 138 139 141 142 144 145 147 148 149 153 155 15...
result:
ok Correct!
Test #8:
score: 0
Accepted
time: 108ms
memory: 16152kb
input:
1 498 499 0 1 1 0 1 0 1 0 0 0 0 2 0 3 1 2 4 0 1 0 1 1 0 0 0 1 1 0 0 2 2 0 1 1 1 0 4 1 1 2 1 0 0 1 2 0 1 2 1 0 1 2 0 2 1 2 2 0 2 2 0 1 0 2 0 0 3 0 1 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 2 1 1 0 1 0 1 0 0 0 1 1 2 0 1 0 2 1 1 2 2 0 0 0 0 2 0 2 1 0 1 0 2 0 1 3 1 1 1 0 1 3 0 1 0 1 0 0 1 3 2 3 2 1 1 0 2 ...
output:
498 1 2 3 5 7 8 12 15 16 18 19 20 24 26 28 29 33 34 35 36 37 39 40 45 46 47 50 52 53 55 56 57 59 60 66 68 69 72 73 74 77 78 79 80 82 83 85 86 88 90 92 96 98 99 102 104 106 107 108 110 111 112 113 114 116 117 118 120 123 124 125 126 127 129 130 132 133 134 135 136 139 140 141 142 146 147 148 149 150 ...
result:
ok Correct!
Test #9:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
5 99 96 2 0 0 1 1 2 1 0 1 1 1 0 0 0 1 0 1 1 2 1 1 1 1 1 0 1 2 4 0 0 0 2 2 1 1 1 1 1 0 2 0 0 0 1 1 3 0 1 0 0 1 2 1 4 1 2 1 0 1 0 0 2 0 0 0 2 3 2 1 0 1 2 2 0 1 1 0 0 1 0 0 1 2 1 3 1 3 1 3 0 3 0 0 2 2 2 2 14 58 1 55 2 53 69 0 0 1 76 2 23 38 1 41 2 74 54 0 0 2 83 91 0 0 0 1 48 0 0 1 96 2 76 52 1 17 2 51...
output:
48 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 43 45 46 47 48 49 50 51 52 53 54 55 57 58 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 44 20 23 56 59 42 44 1 2 3...
result:
ok Correct!
Test #10:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
5 99 97 0 2 4 0 0 2 0 1 1 1 0 1 0 3 0 1 1 1 1 0 0 1 0 0 1 2 0 0 1 3 1 2 0 2 1 1 1 3 3 1 2 1 0 1 0 1 0 2 0 0 0 0 1 2 3 1 1 1 0 1 0 1 0 0 1 2 1 2 1 1 1 2 2 3 1 1 0 0 1 1 0 0 1 1 2 1 2 2 0 1 1 1 2 0 1 3 1 2 56 63 2 52 45 4 26 56 80 10 2 27 19 1 81 2 38 64 1 83 1 8 3 14 81 60 3 63 28 15 5 59 33 80 88 56...
output:
72 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19 20 21 22 23 24 25 26 28 29 30 31 32 33 35 36 37 38 39 40 41 43 44 45 46 47 48 49 50 51 55 56 58 61 63 64 65 66 67 68 69 70 71 74 75 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 95 96 97 99 17 72 94 53 62 98 59 76 34 57 73 27 52 42 60 18 54 67 2 4 7...
result:
ok Correct!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
5 99 98 4 0 1 1 3 2 0 1 4 0 1 1 2 2 1 2 0 0 1 2 1 2 0 1 1 1 2 0 2 0 0 3 0 2 0 0 1 1 1 0 1 1 1 2 0 1 1 0 1 1 1 0 0 1 0 0 2 1 2 3 3 0 0 0 0 0 1 2 1 1 0 3 0 0 0 1 2 0 0 0 0 1 0 2 2 1 2 1 0 1 0 0 1 1 2 3 3 0 5 72 78 90 7 60 6 69 37 10 41 4 59 10 61 85 79 5 7 58 3 55 1 50 6 59 24 30 26 77 21 2 29 21 10 7...
output:
85 1 3 4 5 7 8 9 11 12 13 15 17 18 19 20 21 22 23 24 25 29 30 32 35 36 37 38 40 41 45 47 48 50 51 52 53 54 55 56 59 61 62 65 66 69 70 71 72 73 74 79 81 83 84 85 86 88 89 92 93 94 96 97 99 39 27 42 67 78 76 64 46 68 58 91 49 90 34 33 10 26 98 63 87 57 77 16 44 43 75 95 82 28 6 31 2 14 60 80 87 2 3 5...
result:
ok Correct!
Test #12:
score: 0
Accepted
time: 4ms
memory: 3920kb
input:
5 97 100 1 1 1 0 0 1 0 1 1 2 0 1 2 0 1 0 2 3 0 1 0 1 0 1 0 0 1 0 1 2 0 3 2 2 1 0 1 1 2 3 3 1 0 2 1 1 1 2 2 2 0 2 0 3 1 2 2 2 0 1 0 1 1 0 2 0 0 0 0 3 1 0 0 1 0 1 1 0 0 1 1 2 1 2 0 0 1 2 0 1 1 0 2 0 0 1 0 0 2 2 48 80 1 66 89 71 73 40 2 50 99 68 91 31 76 25 67 94 37 6 88 86 28 22 43 62 21 16 17 39 70 1...
output:
94 2 4 5 6 8 9 10 12 14 15 16 19 20 23 25 26 27 29 30 31 33 34 37 39 40 42 43 44 45 46 47 49 50 51 54 55 56 57 58 60 62 64 68 69 70 71 73 77 78 79 80 87 90 91 92 93 94 95 96 97 24 66 67 72 36 63 3 41 89 35 88 48 53 28 65 38 86 11 13 1 59 17 76 18 7 21 52 83 84 85 81 75 32 22 82 61 74 94 2 6 7 9 10 ...
result:
ok Correct!
Test #13:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
5 96 96 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 72 44 0 0 1 75 0 2 48 35 1 29 1 55 2 75 32 1 95 0 2 87 85 1 69 1 6 2 48 6 1 77 1 67 0 0 1 75 2 59 ...
output:
59 2 3 4 5 7 8 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 91 92 93 94 95 96 9 85 6 45 90 27 44 46 62 1 54 1 2 3 4 6 7 8 ...
result:
ok Correct!
Test #14:
score: 0
Accepted
time: 1ms
memory: 4044kb
input:
1 499 497 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
287 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 25 26 27 28 29 30 31 32 33 34 36 37 38 39 40 41 42 43 44 45 47 48 49 51 52 53 54 55 56 57 58 59 60 61 62 63 64 66 67 68 69 70 71 72 73 74 75 76 77 78 79 81 82 84 85 86 87 88 89 90 91 92 94 95 96 97 98 99 102 103 104 105 106 107 108 109 110...
result:
ok Correct!
Test #15:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
10 50 49 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 43 0 0 2 25 28 0 0 2 28 14 0 2 8 38 1 1 0 1 6 1 41 0 2 40 47 2 8 34 2 26 41 2 31 28 1 5 0 2 33 45 0 2 14 43 0 2 39 34 1 32 1 6 1 15 1 17 0 0 2 9 6 2 37 1 0 2 13 20 0 2 4 41 2 31 5 0 2 44 14 1...
output:
30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 18 19 20 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 48 49 50 16 47 21 27 1 2 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 21 22 23 24 26 27 28 30 31 32 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 12 14 33 25 29 34 16 25 1 2 3 5...
result:
ok Correct!
Test #16:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
10 50 49 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 32 0 0 2 47 41 1 10 3 33 18 13 1 43 1 49 1 39 0 0 3 16 27 31 0 0 2 30 25 3 23 16 37 3 18 1 46 2 8 9 3 32 33 10 3 24 14 31 3 31 11 2 2 8 36 1 44 1 9 0 2 39 27 1 14 1 6 3 47 12 10 1 14 1 10 0 1...
output:
32 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 18 20 23 24 25 27 28 30 31 32 33 34 35 36 37 38 39 40 41 43 44 45 46 47 50 19 29 49 26 22 48 17 6 42 21 31 1 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 39 40 41 44 45 46 47 48 49 50 29 21 4 2 42 43 3 35 1 2 3 5...
result:
ok Correct!
Test #17:
score: 0
Accepted
time: 1ms
memory: 3992kb
input:
1 495 495 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
344 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 31 33 34 35 36 41 42 43 45 46 47 50 51 53 54 55 56 57 58 59 60 63 66 67 68 69 70 71 72 73 74 75 76 77 78 79 81 82 83 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 105 107 108 111 112 113 114 115 116 117 118 119 120 ...
result:
ok Correct!
Test #18:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
250 1 2 1 0 2 1 2 2 2 0 2 1 1 1 1 2 2 1 1 2 1 2 2 1 2 1 1 1 0 2 2 0 2 2 1 2 0 2 1 2 1 1 0 2 2 0 2 1 1 2 1 2 2 1 2 0 0 1 2 0 1 2 1 2 1 1 1 1 1 2 1 2 0 1 1 2 2 1 1 2 1 2 1 1 1 1 1 1 1 2 1 2 0 1 1 1 2 0 1 2 1 2 1 2 0 1 0 1 2 0 1 1 1 2 2 1 1 1 1 2 1 2 2 1 2 1 1 1 1 1 2 1 0 2 1 2 1 2 0 1 2 1 2 1 2 1 0 2 ...
output:
1 1 0 1 2 2 2 1 0 1 1 1 2 1 1 2 1 1 2 0 1 2 1 1 1 1 1 1 2 2 2 1 1 1 1 1 2 1 1 0 1 0 1 2 1 2 2 1 2 1 1 1 1 1 1 2 1 2 0 1 2 2 1 2 1 1 1 1 2 0 1 1 1 1 1 1 1 2 2 1 2 1 1 2 1 1 1 1 2 0 1 1 1 2 1 2 1 1 1 1 2 1 1 2 0 1 2 0 1 0 1 2 1 1 1 1 2 0 1 2 1 1 2 1 1 0...
result:
ok Correct!
Test #19:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
166 3 3 1 1 1 1 1 0 1 1 3 3 1 1 1 1 1 2 1 2 0 3 3 1 2 0 1 1 1 1 0 3 3 1 0 2 0 2 1 2 0 3 3 0 2 1 1 1 2 1 2 2 1 2 3 3 1 0 2 0 0 1 1 3 3 1 0 2 0 1 1 1 1 3 3 1 0 2 0 0 1 1 3 3 0 2 1 2 1 2 0 2 1 2 3 3 0 1 2 0 0 2 1 2 3 3 0 1 2 2 1 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0 0 1 1 3 3 1 2 3 3 1 2 3 2 1 2 3 1 2 3 1 1 5 5 1 2 1 0 1 0 2 1 2 0 3 1 2 3 0 5 5 0 0 1 2 2 3 1 2 3 3 1 2 3 3 1 2 3 0 3 2 3 4 5 5 0 2 1 2 0 1 1 2 1 2 3 1 2 3 1 1 2 1 2 5 5 0 0 0 0 5 0 0 0 0 3 1 2 3 5 5 1 0 0 2 2 1 1 3 1 2 3 2 1 2 3 1 2 3 3 1 2 3 5 5 0 0 1 2 2 3 1 2 3 0 0 2 1 2 1 1 5 5 0 2 0 ...
output:
1 1 2 3 4 5 2 1 3 4 5 2 2 1 2 3 4 5 3 1 2 4 5 3 0 1 2 3 4 5 1 1 2 3 4 5 1 1 2 3 4 5 2 1 2 3 4 5 0 1 2 3 4 5 4 1 3 4 2 5 2 1 2 4 5 3 0 1 2 3 4 5 3 2 4 5 1 3 2 2 3 4 5 1 3 2 3 4 5 1 1 1 2 3 4 5 2 1 3 4 5 2 1 1 2 3 4 5 2 1 2 3 4 5 3 1 3 4 2 5 3 1 4 5 3 2 0 1 2 3 4 5 1 1 2 3 4 5 0...
result:
ok Correct!
Test #22:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
10 49 49 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0 0 1 2 0 2 2 1 1 0 0 2 3 1 2 1 1 1 2 2 0 1 0 1 0 2 2 0 0 4 1 3 3 3 5 3 10 12 16 18 5 2 16 36 21 39 9 19 23 5 31 32 12 15 34 40 0 5 5 19 21 24 30 3 6 8 16 6 15 17 26 2 14 7 1 3 2 14 15 3 16 21 23 6 3 4 17 19 21 22 1 7 7 2 11 28 10 13 31 6 0 6 13 33 43 47 14 1 4...
output:
29 1 2 4 6 7 8 9 11 12 14 15 16 19 21 23 24 25 26 27 29 30 31 35 37 38 40 41 43 44 47 48 49 28 13 32 39 42 22 34 45 46 17 18 5 10 20 33 3 36 22 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 26 27 30 31 33 34 35 37 38 39 40 41 42 43 44 45 46 47 49 28 29 23 2 36 25 32 48 28 1 4 5 6 7 8 9...
result:
ok Correct!
Test #23:
score: 0
Accepted
time: 8ms
memory: 4384kb
input:
1 498 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 2 1 0 1 0 0 2 0 1 0 0 1 1 0 0 0 0 0 2 0 0 1 0 1 0 0 0 0 0 2 1 2 0 1 0 0 1 1 0 1 ...
output:
464 5 6 7 10 12 16 17 18 21 24 26 27 30 33 39 40 43 45 46 48 49 52 54 55 56 59 60 64 73 74 76 78 79 80 81 87 88 91 93 94 100 104 107 109 116 118 129 135 138 142 145 146 151 155 160 162 165 168 170 172 174 175 177 181 182 189 190 197 198 205 208 210 212 218 220 223 225 226 227 229 232 237 238 245 246...
result:
ok Correct!
Test #24:
score: 0
Accepted
time: 231ms
memory: 11160kb
input:
1 497 496 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 1 0 2 1 0 0 0 0 0 0 0 1 1 0 1 0 1 2 1 2 0 1 0 0 1 2 0 1 1 1 0 0 0 0 2 1 1 1 0 0 1 ...
output:
496 10 16 21 24 28 33 43 53 58 60 64 68 78 90 96 97 100 102 106 109 110 112 119 132 133 137 140 141 142 143 149 155 162 170 174 185 186 189 191 198 199 211 212 215 218 222 225 232 233 235 240 241 242 248 252 253 256 261 262 268 269 270 272 275 276 280 284 285 289 293 297 298 303 309 317 318 319 322 ...
result:
ok Correct!
Test #25:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
5 100 100 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 2 0 1 0 0 1 1 1 1 0 2 1 0 0 1 2 1 0 1 1 1 1 0 1 1 2 5 1 0 1 2 0 2 0 3 1 1 1 2 3 2 1 1 1 2 4 2 1 4 1 2 1 0 3 3 1 3 0 0 3 1 0 0 0 3 4 2 1 35 0 1 8 1 35 0 0 1 10 2 15 19 2 1 3 2 6 61 0 0 0 0 2 14 20 2 4 80 0 0 0 1 6 0 1 13 1 4 ...
output:
19 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 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 100 54 26 1...
result:
ok Correct!
Test #26:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
5 95 99 0 0 1 0 0 0 0 0 1 1 0 0 0 2 1 0 0 0 1 0 1 0 0 0 1 2 0 0 1 1 2 0 0 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 2 2 0 0 0 1 0 1 1 1 4 3 0 3 1 2 1 0 1 0 1 5 0 1 1 0 3 0 3 1 2 2 4 0 0 0 1 1 1 2 3 1 0 2 4 0 1 1 4 3 0 1 5 3 31 50 70 1 21 5 14 26 31 2 6 5 7 41 19 45 30 3 1 6 40 0 2 16 19 4 5 6 9 25 0 0 5 17 47...
output:
41 1 2 4 5 6 7 8 9 10 11 12 14 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 43 44 46 47 48 49 50 51 52 53 54 55 56 58 59 60 61 63 64 66 67 68 69 71 72 74 75 76 77 78 80 81 82 83 84 86 87 88 89 90 91 92 93 94 95 42 16 57 65 45 70 3 73 85 79 41 13 62 37 1 2 3 4 5 7 10 11...
result:
ok Correct!
Test #27:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
5 97 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 1 0 0 1 1 2 0 0 1 2 1 0 0 1 2 2 1 0 2 0 1 0 0 3 0 2 3 0 2 1 1 1 1 0 1 1 2 4 1 0 2 1 0 1 2 1 2 2 2 1 2 5 2 0 1 0 3 1 3 1 0 1 2 0 0 2 4 2 2 1 2 1 3 0 0 5 14 16 33 41 9 7 12 28 16 32 45 46 71 10 15 63 65 17 66 18 81 45 8 68 6 8 35 12 54 21 63 0 0 0 ...
output:
67 1 2 4 5 6 7 8 9 11 12 14 15 16 17 18 22 26 28 30 32 33 35 37 38 39 40 43 44 45 46 48 49 52 57 59 61 66 68 70 71 73 74 75 76 79 80 82 83 85 86 88 90 91 92 93 94 42 62 13 25 54 51 65 56 96 47 72 34 67 41 69 58 60 36 21 29 63 50 97 19 78 3 77 95 10 55 87 89 31 53 64 24 81 23 20 27 84 62 2 3 4 5 6 7...
result:
ok Correct!
Test #28:
score: 0
Accepted
time: 5ms
memory: 3812kb
input:
5 95 95 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 0 2 1 0 0 1 1 0 0 1 0 1 0 0 3 0 2 1 1 5 0 0 0 4 3 0 2 1 0 3 2 2 1 2 1 6 1 3 4 2 1 2 2 3 0 2 0 2 1 1 2 2 1 0 2 1 0 0 1 2 3 16 2 9 23 36 52 58 31 65 66 71 72 17 75 24 44 27 28 4 2 32 38 45 21 52 61 94 55 46 79 92 1 11 65 73 95...
output:
89 3 5 8 12 14 16 17 24 25 27 28 30 32 35 37 38 40 41 54 60 62 64 71 72 84 90 94 95 83 9 44 91 53 29 42 73 26 68 31 36 43 92 6 18 66 74 7 59 85 87 21 52 63 80 19 48 55 75 33 57 82 89 23 70 11 88 1 34 45 4 61 93 10 15 47 22 2 46 56 65 76 77 20 49 78 13 67 50 79 51 81 86 39 58 69 89 4 5 6 7 14 18 19 ...
result:
ok Correct!
Test #29:
score: 0
Accepted
time: 1ms
memory: 5792kb
input:
1 498 500 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 2 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 1 2 0 0 1 0 0 0 0 0 1 0 0 2 0 1 1 1 0 0 1 0 2 0 0 1 1 0 0 2 0 0 0 0 0 3 1 0 2 0 1 3 0 0 0 ...
output:
108 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 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 100 101 102 1...
result:
ok Correct!
Test #30:
score: 0
Accepted
time: 2ms
memory: 4352kb
input:
1 500 498 2 0 0 1 1 1 0 0 0 0 1 1 2 2 2 0 1 0 0 0 1 1 1 0 1 1 2 2 2 1 1 0 4 3 1 1 1 1 0 3 0 3 3 1 2 1 0 2 3 2 0 2 0 0 0 1 1 1 0 2 4 1 0 1 1 1 1 3 1 0 0 1 1 2 2 4 1 1 1 0 0 2 2 1 2 1 1 1 0 0 2 0 0 1 0 0 1 1 1 1 0 1 0 0 1 2 1 1 1 2 2 4 2 0 0 0 0 1 1 0 1 4 1 3 0 2 0 3 0 1 1 1 0 4 0 1 1 3 2 0 0 1 0 1 1 ...
output:
258 1 2 3 4 6 7 9 10 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 40 42 43 45 46 47 48 49 51 52 53 54 55 56 59 60 61 62 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 85 86 87 88 89 90 91 92 94 97 98 99 101 102 103 104 107 108 109 110 112 113 114 115 116 11...
result:
ok Correct!
Test #31:
score: 0
Accepted
time: 15ms
memory: 10644kb
input:
1 496 498 0 0 0 0 2 0 0 1 0 1 1 0 2 3 1 1 2 0 3 2 2 0 2 1 2 0 1 1 1 0 1 2 0 0 0 0 5 1 1 0 2 1 0 0 1 0 0 2 0 3 0 0 3 1 0 3 0 1 1 2 1 2 0 2 0 2 1 0 3 0 1 0 1 1 2 0 1 0 0 1 2 1 2 0 1 0 1 1 1 0 3 3 3 2 0 1 2 1 1 3 1 1 0 0 3 0 1 0 0 0 0 1 3 1 0 1 1 2 1 0 1 2 0 2 0 1 1 1 2 2 0 0 1 2 1 1 1 2 1 3 1 1 1 0 0 ...
output:
248 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 28 29 30 31 32 33 34 35 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 61 62 66 68 69 70 71 72 73 74 75 76 78 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 99 100 101 102 103 104 105 106 107 108 109 111 ...
result:
ok Correct!
Test #32:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
10 49 50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 4 0 1 7 2 8 7 2 9 8 0 1 10 1 12 2 13 12 0 0 1 16 2 16 17 0 1 19 0 1 20 1 21 1 23 2 24 23 2 25 24 1 26 1 27 1 27 1 28 0 2 31 30 1 32 0 1 33 1 34 2 35 36 1 37 2 38 37 1 38 1 40 2 41 4...
output:
35 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 16 31 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 37 38 39 40 41 42 43 44 45 46 47 48 49 36 30 1 2 3 4 5 6 7...
result:
ok Correct!
Test #33:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
5 99 99 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 0 2 5 4 1 5 1 7 0 1 9 1 10 0 2 12 11 1 12 1 14 1 14 2 15 16 1 17 0 1 19 1 19 1 21 2 21 2...
output:
60 1 2 3 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 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 4 11 32 66 31 63 1 2 3...
result:
ok Correct!
Test #34:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
1 496 500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
325 1 2 3 4 5 6 7 8 9 10 11 12 13 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 71 72 73 75 76 77 78 79 80 81 82 83 84 86 87 88 89 90 91 92 93 94 95 97 98 99 100 101 103 104 106 107...
result:
ok Correct!
Test #35:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
10 46 47 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 1 5 2 5 6 2 6 5 3 8 6 7 0 1 8 1 10 0 2 11 13 2 14 13 2 14 13 3 15 14 16 2 16 15 1 18 1 18 0 1 20 1 21 1 21 0 2 23 24 1 26 2 27 26 1 27 1 29 1 29 1 31 1 30 1 32 1 32 1 33 2 35 36 2 35 37 1...
output:
34 1 2 3 4 5 7 8 9 10 11 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 36 39 40 41 44 45 46 6 12 35 38 42 37 43 36 1 2 3 4 6 7 8 9 11 13 14 16 17 18 19 20 21 23 24 25 26 27 28 31 32 33 34 35 36 37 38 39 41 42 43 44 46 47 48 5 12 15 22 29 30 40 45 10 39 1 2 3 5 6 7 8 9 10 12 13 ...
result:
ok Correct!
Test #36:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
5 99 99 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 3 2 2 4 3 2 4 3 0 2 6 7 1 6 3 8 7 9 2 10 9 1 11 3 12 11 10 3 13 12 11 1 12 2 13 14 0 1 15 ...
output:
75 3 4 6 7 9 11 12 14 15 16 17 18 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 77 78 79 81 82 84 86 88 89 90 93 94 96 97 98 99 2 5 13 10 19 36 53 76 80 83 85 87 91 92 95 1 8 75 1 2 3...
result:
ok Correct!
Test #37:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
1 495 497 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
383 1 2 4 5 6 7 8 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 35 36 37 38 41 42 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 63 64 65 66 67 68 69 70 71 72 73 76 78 80 82 83 85 86 87 88 89 90 92 94 95 96 97 98 99 102 103 104 106 107 108 109 111 112 113 114 115 116 117 1...
result:
ok Correct!
Test #38:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
10 45 49 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 5 2 0 2 6 5 3 4 5 8 3 9 6 8 3 7 8 10 1 8 3 8 11 10 2 12 10 3 13 12 10 3 14 15 12 3 14 13 12 3 15 17 13 2 15 18 3 19 17 18 4 16 17 19 20 3 18 21 20 1 18 2 19 21 3 21 20 23 3 23 21 25 1 22 3 ...
output:
43 1 2 3 4 5 6 7 11 14 15 16 18 22 25 27 29 30 31 33 34 35 37 40 41 43 44 8 12 13 19 26 32 36 42 39 10 17 28 45 38 9 20 21 23 24 42 1 3 4 5 9 10 11 12 13 14 15 16 18 19 20 22 24 25 29 30 31 32 33 34 35 36 38 39 40 41 44 45 2 7 17 23 27 28 37 43 42 8 21 26 6 44 1 3 5 7 8 9 11 15 17 18 19 22 25 26 2...
result:
ok Correct!
Test #39:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
5 95 98 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 5 1 3 1 6 3 5 4 7 2 7 8 1 7 3 7 10 6 3 9 11 8 4 10 8 9 11 3 9 10 12 1 12 3 12 14 15 1 16 4 14 ...
output:
90 1 2 5 6 8 9 10 12 15 17 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 38 40 41 47 50 51 52 53 56 57 58 60 63 64 67 68 70 72 73 75 77 78 80 81 86 88 89 90 91 92 93 95 3 4 7 11 16 18 34 37 39 43 45 48 49 54 55 61 66 71 74 76 79 85 87 94 13 14 19 42 44 59 69 82 83 84 46 62 65 90 3 5 8 9 10 15 16 ...
result:
ok Correct!
Test #40:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
1 498 496 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
462 2 4 5 6 8 11 12 14 18 19 20 21 22 23 27 28 29 32 33 35 37 38 39 40 41 42 45 48 49 53 56 57 58 59 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 80 82 83 84 87 88 89 90 91 92 93 94 95 96 97 98 99 100 107 108 109 110 112 114 115 116 121 122 123 127 128 130 131 132 133 135 138 140 141 142 144 146 149...
result:
ok Correct!
Test #41:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
10 49 47 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 3 1 7 4 9 8 10 6 11 2 6 3 4 5 3 3 12 10 5 5 9 6 12 7 5 13 7 10 9 11 3 10 6 12 6 12 16 7 8 10 9 7 11 9 16 12 17 10 15 5 15 14 11 13 9 3 12 18 16 5 13 20 17 15 19 4 15 19 17 12 7 13 15 22 18 19 17 ...
output:
47 1 2 3 4 5 6 10 14 15 17 19 20 21 22 24 26 27 30 31 32 34 36 37 38 40 41 43 44 46 47 48 49 8 11 13 7 23 16 18 25 35 29 33 45 42 9 12 28 39 48 2 3 5 7 9 10 11 12 13 15 16 17 19 20 21 22 23 24 28 30 31 32 36 37 38 39 40 42 46 47 48 4 6 14 25 18 26 33 34 27 35 43 45 8 29 41 44 1 47 3 4 7 8 9 11 13 ...
result:
ok Correct!
Test #42:
score: 0
Accepted
time: 1ms
memory: 3908kb
input:
5 99 100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 9 7 5 2 9 8 11 7 6 5 8 4 9 3 11 6 9 8 13 10 12 4 6 5 6 12 14 9 11 2 10 14 8 12 15 8 9 14 ...
output:
99 2 4 6 7 8 9 13 14 16 17 18 19 22 23 25 26 29 30 33 34 36 37 39 41 42 43 44 46 48 50 53 55 56 58 59 62 64 65 66 68 70 74 75 76 80 82 83 84 87 89 90 91 97 98 99 96 1 15 10 12 21 31 24 28 32 35 38 45 49 52 57 61 69 72 71 77 85 86 81 88 5 3 92 95 11 40 20 27 47 51 63 54 67 78 93 94 60 73 79 95 2 4 5...
result:
ok Correct!
Test #43:
score: 0
Accepted
time: 2ms
memory: 3868kb
input:
1 498 499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
497 1 3 4 5 8 10 11 12 13 16 17 19 20 21 22 23 24 26 27 30 33 36 41 42 45 46 47 48 52 53 54 55 59 62 65 70 74 75 77 80 81 82 83 84 90 97 98 99 100 102 103 104 106 114 118 120 124 125 126 127 130 132 136 141 143 147 149 150 151 154 156 160 161 163 164 165 166 171 173 176 177 178 180 184 185 186 187 1...
result:
ok Correct!