QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#427335 | #8759. 小班课 | wsc2008 | AC ✓ | 208ms | 24096kb | C++14 | 3.5kb | 2024-06-01 12:47:47 | 2024-06-01 12:47:48 |
Judging History
answer
#pragma GCC optimize(2,3,"Ofast","inline","unroll-loops")
#include<bits/stdc++.h>
typedef int ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll,ll>
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define per(i,a,b) for(ll i=(a);i>=(b);--i)
using namespace std;
bool Mbe;
ll read(){
ll x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
void write(ll x){
if(x<0)putchar('-'),x=-x;
if(x>9)write(x/10);
putchar(x%10+'0');
}
const ll N=2009,INF=1e6;
ll n,m,b[N],a[N][N],to[N][N],rev[N][N],par[N],v[N],tim;
ll S,T,hd[N],tot=1,d[N],flow[N],in[N],mnc,mxf,cur[N];
struct Edg{
ll to,nxt,f,c;
}es[N*N*2];
vector<ll>mch[N];
void init(){
S=0,T=n+m+1;
rep(i,0,T)hd[i]=0;
tot=1;
mnc=mxf=0;
}
void adde(ll x,ll y,ll f,ll c){
es[++tot]=(Edg){y,hd[x],f,c};
hd[x]=tot;
es[++tot]=(Edg){x,hd[y],0,-c};
hd[y]=tot;
}
bool spfa(){
deque<ll>q;
q.push_back(T);
rep(i,0,T)d[i]=INF,in[i]=0;
d[T]=0,in[T]=1;
while(!q.empty()){
ll u=q.front();q.pop_front();
in[u]=0;
for(ll i=hd[u];i;i=es[i].nxt){
ll v=es[i].to,f=es[i^1].f,c=es[i^1].c;
if(d[v]>d[u]+c&&f){
d[v]=d[u]+c;
// flow[v]=min(flow[u],f);
// pre_v[v]=u,pre_e[v]=i;
if(!in[v]){
in[v]=1;
if(!q.empty()&&d[v]<d[q.front()])q.push_front(v);
else q.push_back(v);
}
// if(v==T)return 1;
}
}
}
// return 0;
return d[S]!=INF;
}
ll dinic(ll u,ll flow){
if(u==T||!flow)return flow;
in[u]=1;
ll rst=flow,res=0;
for(ll &i=cur[u];i;i=es[i].nxt){
ll v=es[i].to,f=es[i].f,c=es[i].c;
if(!in[v]&&f&&d[v]+c==d[u]){
ll k=dinic(v,min(f,rst));
if(k){
mnc+=c*k;
es[i].f-=k;
es[i^1].f+=k;
res+=k;
rst-=k;
}
else d[v]=-INF*5;
if(!rst){
in[u]=0;
return flow;
}
}
}
in[u]=0;
return res;
}
void runflow(){
while(spfa()){
rep(i,0,T)cur[i]=hd[i];
ll x;
while((x=dinic(S,INF)))mxf+=x;
}
}
void solve(ll x){
if(v[x])return ;
v[x]=1;
for(ll y:mch[x]){
ll qd=rev[y][x];
rep(j,1,qd-1)solve(to[y][j]);
}
for(ll y:mch[x])par[++tim]=y;
}
void solve(){
memset(v,0,sizeof(v));
tim=0;
n=read(),m=read();
init();
rep(i,1,m)b[i]=read(),adde(n+i,T,b[i],0);
rep(i,1,n){
adde(S,i,1,0);
ll k=read();
rep(j,0,m+1)rev[i][j]=0;
rep(j,1,k){
ll x=read();
adde(i,x+n,1,j);
to[i][j]=x,rev[i][x]=j;
}
}
runflow();
write(mxf),putchar('\n');
rep(i,0,m+1)mch[i].clear();
rep(i,1,n){
ll fnd=0;
for(ll j=hd[i];j;j=es[j].nxt){
ll v=es[j].to,f=es[j].f;
if(!f&&v>n){
mch[v-n].push_back(i);
fnd=1;
continue;
}
}
if(!fnd)mch[m+1].push_back(i);
}
// ll sum=0;
// rep(i,1,m+1)sum+=mch[i].size();
rep(i,1,m+1)solve(i);
rep(i,1,n)write(par[i]),putchar(' ');
putchar('\n');
}
bool Med;
int main(){
// freopen("a.in","r",stdin);
cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";
ll T=read();
while(T--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 8032kb
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 5 4 1 3 2 5 5 1 2 3 4 5 2 5 1 3 4
result:
ok Correct!
Test #2:
score: 0
Accepted
time: 2ms
memory: 8204kb
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 2 1 1 1 1 2 1 0 1 2 1 1 1 1 0 1 1 1 2 2 1 0 1 0 1 1 1 2 2 1 2 0 1 0 1 0 1 0 1 2 2 1 2 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 2 1 2 2 1 2 1 2 1 1 1...
result:
ok Correct!
Test #3:
score: 0
Accepted
time: 1ms
memory: 7964kb
input:
166 3 3 1 1 1 0 2 2 3 0 3 3 0 3 0 0 2 1 3 0 3 3 0 0 3 0 2 2 3 0 3 3 2 0 1 2 2 3 0 2 3 2 3 3 0 2 1 2 3 1 0 2 2 1 3 3 1 1 1 2 3 1 2 1 2 1 3 3 3 2 1 0 1 3 0 0 3 3 1 1 1 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2 3 3 3...
result:
ok Correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 8080kb
input:
100 5 5 2 1 2 0 0 0 2 3 2 3 5 4 3 2 1 2 0 5 5 0 2 0 0 3 1 5 0 1 1 0 0 5 5 0 1 3 0 1 2 5 4 2 1 5 0 0 3 3 1 4 5 5 1 1 0 2 1 1 2 0 2 4 5 0 1 4 5 5 0 1 1 2 1 2 4 2 0 2 1 3 0 1 1 5 5 0 0 2 2 1 2 4 3 1 4 0 3 5 4 1 3 5 1 2 5 5 1 2 1 0 1 2 1 2 0 3 3 5 2 2 4 3 0 5 5 1 0 1 1 2 0 1 4 1 3 1 3 0 5 5 1 2 1 1 0 1 ...
output:
3 4 2 3 1 5 1 1 2 3 4 5 2 5 1 2 3 4 3 1 3 5 2 4 2 3 1 2 4 5 4 5 2 4 1 3 3 1 4 3 2 5 2 4 2 1 3 5 1 1 2 3 4 5 4 3 4 2 1 5 2 2 3 1 4 5 2 1 4 2 3 5 3 5 2 3 1 4 3 4 1 3 2 5 3 2 1 4 3 5 3 3 2 1 4 5 2 3 1 2 4 5 3 1 4 5 2 3 1 1 2 3 4 5 3 2 5 3 1 4 1 4 1 2 3 5 2 4 3 1 2 5 2 4 1 2 3 5 2...
result:
ok Correct!
Test #6:
score: 0
Accepted
time: 2ms
memory: 10036kb
input:
10 45 47 3 0 2 0 1 1 1 0 2 0 1 0 0 3 0 0 0 4 0 1 0 0 1 2 1 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 21 7 39 19 12 37 10 13 4 18 17 24 43 8 38 42 16 36 14 15 11 29 5 40 34 30 31 3 6 25 35 44 2 9 20 22 23 26 27 28 32 33 41 45 39 40 21 26 30 15 28 12 31 5 19 1 7 41 23 45 14 44 20 2 33 38 11 29 32 39 3 43 16 18 36 10 17 34 9 35 42 25 6 24 4 8 13 22 27 37 36 23 43 1 40 3 21 29 8 11 16 19 33 26 2...
result:
ok Correct!
Test #7:
score: 0
Accepted
time: 4ms
memory: 16612kb
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 378 192 306 322 122 234 145 444 491 17 125 381 493 284 349 480 262 499 240 330 315 321 285 219 249 363 457 4 93 121 237 213 54 340 362 165 253 459 106 97 217 452 271 69 70 462 387 64 438 96 344 383 389 447 30 171 116 199 226 398 283 391 207 212 153 79 224 173 221 73 454 486 98 210 194 392 401 8 ...
result:
ok Correct!
Test #8:
score: 0
Accepted
time: 208ms
memory: 24096kb
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 244 390 189 399 251 356 86 401 464 382 211 363 488 124 147 386 24 424 341 102 361 330 351 18 19 242 283 360 438 248 6 21 181 446 261 431 127 445 213 266 343 231 440 83 51 156 443 219 279 60 353 144 2 288 230 215 205 323 421 268 384 159 139 274 137 337 28 192 165 340 46 3 141 55 204 494 134 416 1...
result:
ok Correct!
Test #9:
score: 0
Accepted
time: 0ms
memory: 10268kb
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 3 44 34 46 74 92 69 45 21 88 99 7 30 57 78 42 77 87 93 72 97 59 24 16 22 6 20 9 38 40 65 2 23 53 26 94 35 62 95 12 60 25 71 82 73 56 19 39 1 4 5 8 10 11 13 14 15 17 18 27 28 29 31 32 33 36 37 41 43 47 48 49 50 51 52 54 55 58 61 63 64 66 67 68 70 75 76 79 80 81 83 84 85 86 89 90 91 96 98 44 42 32...
result:
ok Correct!
Test #10:
score: 0
Accepted
time: 2ms
memory: 10176kb
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 85 13 42 60 8 49 41 9 12 83 39 70 98 20 79 3 58 55 73 22 24 99 11 72 29 46 97 6 37 52 14 59 68 17 47 40 57 96 76 23 71 33 45 27 82 91 1 16 25 62 78 44 34 48 64 54 28 90 81 30 32 95 77 35 7 53 94 18 63 87 65 66 2 4 5 10 15 19 21 26 31 36 38 43 50 51 56 61 67 69 74 75 80 84 86 88 89 92 93 67 76 92...
result:
ok Correct!
Test #11:
score: 0
Accepted
time: 2ms
memory: 10044kb
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 8 66 85 63 97 95 71 83 55 46 54 53 76 12 39 98 10 16 43 6 30 74 65 47 58 31 14 62 80 77 20 24 11 42 81 93 72 51 29 79 33 26 25 44 67 28 35 99 38 41 59 68 23 50 19 5 60 90 75 2 69 40 73 21 34 64 4 86 78 91 1 32 89 82 3 15 87 70 84 49 96 27 37 94 57 7 9 13 17 18 22 36 45 48 52 56 61 88 92 87 82 89...
result:
ok Correct!
Test #12:
score: 0
Accepted
time: 4ms
memory: 10244kb
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 16 15 9 24 96 18 50 72 47 91 87 39 2 41 67 51 40 37 35 80 63 66 30 45 75 84 8 4 6 52 55 28 64 54 60 62 93 76 53 82 97 25 31 34 27 57 61 78 69 1 10 13 3 38 70 90 29 59 79 58 92 12 42 49 88 56 85 11 86 7 23 77 20 89 81 44 74 71 73 21 48 14 22 5 32 19 83 33 43 17 65 94 26 36 46 68 95 94 40 22 79 16...
result:
ok Correct!
Test #13:
score: 0
Accepted
time: 1ms
memory: 8044kb
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 82 44 58 31 15 45 47 87 29 86 67 70 64 74 34 20 9 6 12 85 68 81 89 71 62 1 39 51 25 41 61 8 23 56 21 78 49 96 32 55 48 17 13 88 46 91 16 83 90 60 73 79 36 80 75 27 65 35 24 2 3 4 5 7 10 11 14 18 19 22 26 28 30 33 37 38 40 42 43 50 52 53 54 57 59 63 66 69 72 76 77 84 92 93 94 95 54 87 60 89 33 59...
result:
ok Correct!
Test #14:
score: 0
Accepted
time: 3ms
memory: 14312kb
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 8 243 368 167 299 391 283 270 369 386 382 371 6 451 432 398 378 101 136 399 277 264 346 23 68 192 122 80 362 348 295 358 402 65 34 425 214 344 409 310 341 487 356 83 480 120 108 15 69 407 183 336 311 227 35 58 186 342 255 148 87 156 445 485 280 449 258 300 490 39 411 28 476 360 327 238 489 178 6...
result:
ok Correct!
Test #15:
score: 0
Accepted
time: 0ms
memory: 9976kb
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 10 44 37 19 27 16 32 48 35 23 45 29 4 17 7 50 38 43 49 33 9 25 15 13 1 40 21 46 47 41 2 3 5 6 8 11 12 14 18 20 22 24 26 28 30 31 34 36 39 42 27 20 49 35 24 50 3 38 6 43 44 39 14 29 10 25 33 27 17 41 9 21 34 16 40 45 48 5 1 2 4 7 8 11 12 13 15 18 19 22 23 26 28 30 31 32 36 37 42 46 47 25 28 4 41...
result:
ok Correct!
Test #16:
score: 0
Accepted
time: 0ms
memory: 7924kb
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 47 17 45 7 49 28 22 24 31 9 26 42 21 39 19 6 30 12 16 20 33 36 40 15 48 38 44 29 4 46 23 8 1 2 3 5 10 11 13 14 18 25 27 32 34 35 37 41 43 50 31 1 31 11 29 36 17 32 16 48 27 39 23 4 26 2 3 33 21 5 41 43 47 42 49 28 6 40 46 25 38 34 7 8 9 10 12 13 14 15 18 19 20 22 24 30 35 37 44 45 50 35 50 30 1...
result:
ok Correct!
Test #17:
score: 0
Accepted
time: 3ms
memory: 16476kb
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 492 395 136 317 16 453 476 161 212 133 462 205 373 181 272 280 220 77 461 471 185 261 169 233 18 94 347 451 285 465 6 121 490 283 288 144 365 291 494 414 182 250 49 436 262 78 417 351 80 62 495 147 466 124 145 375 426 193 361 313 208 278 113 484 376 419 241 172 96 155 306 475 187 440 253 353 159...
result:
ok Correct!
Test #18:
score: 0
Accepted
time: 1ms
memory: 8036kb
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 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1 2 3 4 5 3 5 1 3 2 4 2 5 1 2 3 4 3 4 1 3 2 5 1 5 1 2 3 4 2 4 3 1 2 5 1 4 1 2 3 5 2 1 4 2 3 5 3 4 2 5 1 3 3 4 3 2 1 5 0 1 2 3 4 5 1 2 1 3 4 5 0...
result:
ok Correct!
Test #22:
score: 0
Accepted
time: 2ms
memory: 7964kb
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 6 26 38 9 7 34 11 28 10 45 16 41 49 39 17 13 30 20 5 32 42 18 15 3 33 46 36 2 22 1 4 8 12 14 19 21 23 24 25 27 29 31 35 37 40 43 44 47 48 22 13 38 24 27 22 28 21 12 29 9 36 45 25 2 46 23 41 42 47 32 7 48 1 3 4 5 6 8 10 11 14 15 16 17 18 19 20 26 30 31 33 34 35 37 39 40 43 44 49 28 41 32 31 28 3...
result:
ok Correct!
Test #23:
score: 0
Accepted
time: 6ms
memory: 18400kb
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 109 49 17 483 251 475 296 205 496 306 43 7 340 226 32 130 18 276 454 400 100 12 81 330 145 5 74 184 129 93 13 458 396 352 198 398 497 262 94 290 319 326 56 189 372 30 162 146 231 52 366 175 163 135 315 384 284 434 57 227 355 90 410 342 433 344 245 385 474 378 229 79 337 78 201 218 316 392 23 486...
result:
ok Correct!
Test #24:
score: 0
Accepted
time: 159ms
memory: 19436kb
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 142 427 141 412 250 352 289 78 280 209 451 477 482 346 403 143 433 490 409 448 137 268 131 199 189 211 450 132 308 241 179 495 194 417 341 414 43 100 476 378 494 284 350 225 487 95 270 21 222 334 463 455 276 112 293 496 327 485 186 64 393 45 459 49 39 58 233 328 240 277 13 242 478 449 497 76 257...
result:
ok Correct!
Test #25:
score: 0
Accepted
time: 2ms
memory: 9984kb
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 84 7 83 66 79 27 76 54 92 43 57 39 59 48 73 10 98 37 16 1 2 3 4 5 6 8 9 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 28 29 30 31 32 33 34 35 36 38 40 41 42 44 45 46 47 49 50 51 52 53 55 56 58 60 61 62 63 64 65 67 68 69 70 71 72 74 75 77 78 80 81 82 85 86 87 88 89 90 91 93 94 95 96 97 99 100 26 8...
result:
ok Correct!
Test #26:
score: 0
Accepted
time: 2ms
memory: 10040kb
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 88 19 18 5 92 54 17 78 59 15 87 16 42 51 63 75 71 89 49 61 41 44 70 85 83 3 36 47 30 65 82 57 13 73 28 84 69 45 62 79 43 1 2 4 6 7 8 9 10 11 12 14 20 21 22 23 24 25 26 27 29 31 32 33 34 35 37 38 39 40 46 48 50 52 53 55 56 58 60 64 66 67 68 72 74 76 77 80 81 86 90 91 93 94 95 37 70 96 57 10 65 19...
result:
ok Correct!
Test #27:
score: 0
Accepted
time: 0ms
memory: 10044kb
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 52 86 66 94 38 80 54 43 59 72 2 41 13 67 57 16 51 14 75 10 69 26 53 87 25 49 73 29 63 47 77 93 42 48 5 56 83 65 81 97 23 55 78 92 24 31 95 4 50 71 27 21 3 96 34 62 36 64 84 58 70 19 20 89 45 22 60 1 6 7 8 9 11 12 15 17 18 28 30 32 33 35 37 39 40 44 46 61 68 74 76 79 82 85 88 90 91 62 77 50 78 16...
result:
ok Correct!
Test #28:
score: 0
Accepted
time: 0ms
memory: 10348kb
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 71 3 82 17 54 44 37 43 9 10 14 60 73 16 27 40 83 72 25 64 94 7 66 85 28 29 19 30 55 68 81 1 31 74 91 38 63 88 77 95 18 53 56 75 21 84 32 33 23 22 57 93 11 15 35 70 78 86 45 41 65 92 4 79 20 52 59 13 26 50 76 48 87 6 80 49 61 69 34 36 89 47 39 46 42 58 2 51 67 5 8 12 24 62 90 89 5 19 91 92 20 27 ...
result:
ok Correct!
Test #29:
score: 0
Accepted
time: 3ms
memory: 16324kb
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 464 457 432 471 300 427 493 144 188 57 243 48 392 212 354 282 139 437 397 149 161 127 409 297 440 497 14 58 374 379 394 298 237 294 323 110 197 453 17 60 365 382 407 54 133 251 307 228 472 393 445 160 137 33 192 94 405 153 173 459 494 195 347 159 186 51 401 277 187 125 446 286 291 330 86 372 199...
result:
ok Correct!
Test #30:
score: 0
Accepted
time: 0ms
memory: 18380kb
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 481 490 497 192 460 250 378 397 273 256 63 340 478 343 470 189 313 336 331 79 150 110 194 66 108 60 471 1 122 249 220 268 205 352 466 487 152 400 111 184 209 291 293 130 498 28 361 366 488 76 267 421 252 295 93 155 254 332 414 302 146 156 290 371 491 489 225 436 213 393 216 231 353 193 448 475 4...
result:
ok Correct!
Test #31:
score: 0
Accepted
time: 29ms
memory: 20684kb
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 14 97 378 273 371 159 296 218 285 496 32 49 300 238 356 264 399 480 117 234 31 106 130 125 486 136 219 47 73 211 28 489 261 143 213 321 323 83 194 114 447 437 465 242 292 345 415 474 186 225 354 468 207 169 4 45 448 198 269 44 63 111 450 438 459 50 202 400 348 80 101 491 455 402 173 337 365 330 ...
result:
ok Correct!
Test #32:
score: 0
Accepted
time: 2ms
memory: 10024kb
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 4 6 7 8 10 11 12 15 16 18 20 21 22 23 24 25 27 28 30 31 33 34 35 36 38 39 40 41 43 44 45 46 48 49 2 3 5 9 13 14 17 19 26 29 32 37 42 47 31 1 49 7 9 11 12 13 14 16 17 18 20 21 23 24 27 28 29 30 32 34 35 36 37 38 40 42 43 45 46 47 2 3 4 5 6 8 10 15 19 22 25 26 31 33 39 41 44 48 30 1 2 4 6 8 9 1...
result:
ok Correct!
Test #33:
score: 0
Accepted
time: 0ms
memory: 10036kb
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 5 4 6 8 9 12 11 14 15 16 19 21 22 23 25 26 27 33 32 31 34 36 38 40 41 43 44 45 50 51 53 55 56 57 58 60 62 67 66 68 69 70 71 73 75 76 77 81 84 85 87 88 91 93 94 95 96 97 99 2 3 7 10 13 17 18 20 24 28 29 30 35 37 39 42 46 47 48 49 52 54 59 61 63 64 65 72 74 78 79 80 82 83 86 89 90 92 98 63 1 2 3...
result:
ok Correct!
Test #34:
score: 0
Accepted
time: 3ms
memory: 16164kb
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 6 7 9 11 12 13 14 16 18 23 24 26 27 28 29 30 31 32 35 36 38 40 42 43 44 45 47 49 50 53 54 55 57 58 60 62 63 64 65 66 68 69 70 71 73 75 74 76 77 78 82 84 85 88 90 91 92 93 95 97 96 98 99 101 103 102 104 105 107 108 109 112 113 114 115 116 117 118 119 120 121 122 125 124 126 127 129 131 13...
result:
ok Correct!
Test #35:
score: 0
Accepted
time: 0ms
memory: 8040kb
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 46 2 4 5 8 6 9 11 13 12 14 15 17 19 21 23 24 26 28 30 29 32 33 34 36 35 40 39 37 41 42 43 45 44 1 3 7 10 16 18 20 22 25 27 31 38 36 47 2 3 6 5 7 8 13 12 10 9 14 16 15 17 18 21 22 25 28 27 31 30 29 33 34 35 36 38 37 42 40 41 44 45 46 1 4 11 19 20 23 24 26 32 39 43 48 39 1 49 48 5 4 6 8 9 10 11 1...
result:
ok Correct!
Test #36:
score: 0
Accepted
time: 0ms
memory: 10092kb
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 99 3 2 1 6 5 7 12 9 10 8 11 13 15 16 18 20 19 22 23 24 27 30 32 34 37 36 38 39 41 42 44 45 46 47 48 50 54 53 55 56 58 59 60 62 63 64 67 66 68 70 72 73 74 75 77 76 80 82 81 84 83 86 85 88 87 90 89 91 93 92 97 95 96 98 4 14 17 21 25 26 28 29 31 33 35 40 43 49 51 52 57 61 65 69 71 78 79 94 75 1 3 5...
result:
ok Correct!
Test #37:
score: 0
Accepted
time: 0ms
memory: 16460kb
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 2 4 3 6 8 10 9 11 13 12 14 18 20 21 22 23 25 26 27 30 31 32 33 34 36 37 39 42 41 40 43 45 48 47 51 52 53 54 55 57 60 59 61 62 64 63 66 65 68 67 69 71 70 73 72 74 75 76 78 77 79 80 81 82 83 84 86 87 89 90 92 91 94 93 95 96 97 98 99 103 101 100 102 107 105 106 108 109 111 110 112 114 115 117 119 1...
result:
ok Correct!
Test #38:
score: 0
Accepted
time: 2ms
memory: 10088kb
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 4 3 6 7 5 12 14 11 9 8 10 16 13 18 15 19 17 22 20 21 23 25 24 26 30 28 27 31 33 34 32 37 35 41 39 38 36 43 40 44 42 45 2 29 42 45 4 2 3 1 9 7 8 6 5 12 10 13 14 16 15 17 19 22 23 21 18 20 25 24 29 28 26 30 27 32 34 33 35 36 38 37 41 44 42 39 43 11 31 40 44 44 1 5 4 46 2 3 8 7 6 11 9 12 15 14 1...
result:
ok Correct!
Test #39:
score: 0
Accepted
time: 0ms
memory: 10040kb
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 95 1 3 2 6 4 9 8 7 10 11 17 13 12 14 21 18 15 16 19 20 22 23 24 26 25 28 29 31 32 30 33 36 34 38 35 37 40 39 41 47 45 42 43 44 46 50 48 51 49 53 52 54 56 55 58 63 61 59 60 62 64 67 66 65 68 71 69 70 72 73 75 74 77 76 80 79 83 81 82 87 85 84 86 90 89 93 92 91 94 5 27 57 78 88 90 97 3 1 5 2 8 11 7...
result:
ok Correct!
Test #40:
score: 0
Accepted
time: 0ms
memory: 16388kb
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 494 1 497 2 498 4 6 8 7 9 10 14 18 19 13 17 15 12 20 21 23 22 26 25 27 24 29 30 35 34 32 31 28 33 37 36 39 41 38 42 45 44 43 46 48 47 51 49 50 52 56 54 53 57 55 58 64 60 62 59 61 65 66 68 67 69 70 72 74 71 75 73 76 78 77 80 79 83 84 81 82 90 86 85 87 89 91 92 95 94 93 96 98 97 99 100 102 101 103...
result:
ok Correct!
Test #41:
score: 0
Accepted
time: 2ms
memory: 8216kb
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 44 49 3 47 4 46 45 48 2 8 6 10 5 13 9 7 14 20 18 12 11 15 16 22 21 25 17 19 26 23 31 28 27 24 34 29 37 30 38 32 43 36 40 41 42 35 39 1 33 48 44 40 45 47 36 46 43 2 17 14 7 8 1 5 3 4 12 6 10 13 9 15 11 16 21 19 22 18 20 25 24 23 26 30 32 27 28 31 34 37 35 29 33 39 41 42 38 48 47 11 6 1 45 3 4 47...
result:
ok Correct!
Test #42:
score: 0
Accepted
time: 0ms
memory: 8004kb
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 96 89 88 93 4 2 99 97 3 5 1 6 8 7 15 10 12 16 13 11 9 18 22 20 21 14 23 17 25 26 33 37 32 27 19 24 30 29 28 35 34 31 36 42 41 39 38 40 44 46 45 43 48 49 47 55 52 56 62 61 54 53 50 51 57 64 59 58 68 60 65 63 69 66 70 71 72 67 75 74 76 87 83 81 73 78 77 80 79 82 85 84 86 91 94 95 92 90 98 95 89 90...
result:
ok Correct!
Test #43:
score: 0
Accepted
time: 0ms
memory: 14248kb
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 498 481 486 488 497 492 496 4 11 8 7 2 495 6 1 3 5 36 35 31 29 25 24 18 9 17 12 14 10 13 15 20 21 16 22 19 26 28 27 23 41 39 38 32 30 34 33 37 47 46 43 45 40 51 49 42 48 44 53 54 52 50 59 55 56 65 58 64 60 57 62 77 70 63 68 69 67 61 72 66 74 75 76 71 80 73 82 78 83 97 100 94 87 92 84 89 86 81 79...
result:
ok Correct!