QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#723386#67. Two TransportationsL_Wave6 155ms22188kbC++203.6kb2024-11-07 22:02:172024-11-07 22:02:18

Judging History

你现在查看的是最新测评结果

  • [2024-11-07 22:02:18]
  • 评测
  • 测评结果:6
  • 用时:155ms
  • 内存:22188kb
  • [2024-11-07 22:02:17]
  • 提交

Azer

// ---------------- A ----------------

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i <= i##ABRACADABRA; i++)
#define drep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i >= i##ABRACADABRA; i--)
using namespace std;
using ll = long long;

#ifndef LOCAL
#include"Azer.h"
#endif

namespace A{
  int n,m,U[2]={11,9},ty,num,V[2],v,lst,now,dis[3010];
  bool vis[3010];
  vector<pair<int,int>>G[3010];
  void S(int x,int t){
    if (x>=1e8){
      drep(i,t-1,0)SendA(1);
      return ;
    }
    // printf("A send: x=%d\n",x);
    drep(i,t-1,0)SendA(x>>i&1);
  }
  bool ins(bool x){
    V[ty]=V[ty]<<1|x;
    return --num;
  }
  void sty(int nt){
    V[ty=nt]=0;
    num=U[nt];
  }
  void upd(int u,int d){
    // printf("A upd: u=%d,d=%d\n",u,d);
    lst=dis[u]=d,vis[u]=1;
    for (auto [v,w]:G[u])
      if (dis[v]>w+d)dis[v]=w+d;
    v=n;
    rep(i,1,n)if (!vis[i]&&dis[v]>dis[i])v=i;
    now=dis[v];
    // if (v==n)return ;
    sty(1),S(now-lst,U[1]);
    // printf("A get v=%d\n",v);
  }
  void InitA(int _n,int _m,vector<int>u,vector<int>v,vector<int>w){
    memset(dis,0x3f,sizeof(dis));
    memset(vis,0,sizeof(vis));
    n=_n,m=_m;
    rep(i,0,m-1){
      G[u[i]].push_back({v[i],w[i]});
      G[v[i]].push_back({u[i],w[i]});
    }
    upd(0,0);
  }
  void ReceiveA(bool x){
    if (ins(x))return ;
    if (!ty)upd(V[0],V[1]+lst);
    else{
      // printf("A rec w=%d\n",V[1]);
      if (V[1]+lst>=now){ // change to > when B
        // puts("A win now");

          S(v,U[0]);
          upd(v,now);

      }else
        sty(0);
    }
  }
  vector<int>Answer(){
    vector<int>res(n);
    rep(i,0,n-1)res[i]=dis[i];
    return res;
  }
}

void InitA(int _n,int _m,vector<int>u,vector<int>v,vector<int>w){A::InitA(_n,_m,u,v,w);}
void ReceiveA(bool x){A::ReceiveA(x);}
vector<int>Answer(){return A::Answer();}

Baijan

// ---------------- B ----------------

#ifndef LOCAL
#include"Baijan.h"
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i <= i##ABRACADABRA; i++)
#define drep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i >= i##ABRACADABRA; i--)
using namespace std;
using ll = long long;
#endif

namespace B{
  int n,m,U[2]={11,9},ty,num,V[2],v,lst,now,dis[3010];
  bool vis[3010];
  vector<pair<int,int>>G[3010];
  void S(int x,int t){
    if (x>=1e8){
      drep(i,t-1,0)SendB(1);
      return ;
    }
    // printf("B send: x=%d\n",x);
    drep(i,t-1,0)SendB(x>>i&1);
  }
  bool ins(bool x){
    V[ty]=V[ty]<<1|x;
    return --num;
  }
  void sty(int nt){
    V[ty=nt]=0;
    num=U[nt];
  }
  void upd(int u,int d){
    // printf("B upd: u=%d,d=%d\n",u,d);
    lst=dis[u]=d,vis[u]=1;
    for (auto [v,w]:G[u])
      if (dis[v]>w+d)dis[v]=w+d;
    v=n;
    rep(i,1,n)if (!vis[i]&&dis[v]>dis[i])v=i;
    now=dis[v];
    // if (v==n)return ;
    sty(1),S(now-lst,U[1]);
    // printf("B get v=%d\n",v);
  }
  void InitB(int _n,int _m,vector<int>u,vector<int>v,vector<int>w){
    memset(dis,0x3f,sizeof(dis));
    memset(vis,0,sizeof(vis));
    n=_n,m=_m;
    rep(i,0,m-1){
      G[u[i]].push_back({v[i],w[i]});
      G[v[i]].push_back({u[i],w[i]});
    }
    upd(0,0);
  }
  void ReceiveB(bool x){
    if (ins(x))return ;
    if (!ty)upd(V[0],V[1]);
    else{
      // printf("B rec w=%d\n",V[1]);
      if (V[1]+lst>now){ // change to >= when A
        // puts("B win now");

          S(v,U[0]);
          upd(v,now);

      }else
        sty(0);
    }
  }
}

void InitB(int _n,int _m,vector<int>u,vector<int>v,vector<int>w){B::InitB(_n,_m,u,v,w);}
void ReceiveB(bool x){B::ReceiveB(x);}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 19ms
memory: 4020kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -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:

-1
0 1 0 1 1 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 1 1 1 -1
1 0 1 0 1 1 0 1 1 0 1 0 0 0 0 1 1 0 0 1 -1
0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 -1
1 0 1 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 1 1 -1
0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 -1
0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 -1
0 1 1 0 0 0 0 1 1 1 1...

input:


output:

0
2417
4435
3092
3018
2637
2136
3353
4117
2498
3522
3354
2776
1912
3232
3382
2310
2867
3546
2681
2605
3912
3045
3311
1307
2094
1352
3087
3487
3865
3223
4033
3647
2816
2468
1263
2756
3086
1735
3002
2385
2754
2837
3718
2891
2201
3478
3041
2726
3012
2634
2599
914
3509
4886
2317
4081
1993
2391
2749
3551...

result:

ok 2000 lines

Test #2:

score: 6
Accepted
time: 1ms
memory: 3956kb

input:

1 1 1 1 1 1 1 1 1 -1
-1
-1

output:

-1
1 1 1 1 1 1 1 1 1 -1
-1

input:


output:

0

result:

ok single line: '0'

Test #3:

score: 6
Accepted
time: 22ms
memory: 4116kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -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:

-1
1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 1 -1
0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 1 0 -1
0 1 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 -1
1 1 1 1 0 0 0 1 1 1 0 1 0 0 1 1 0 1 1 0 -1
1 0 1 1 0 1 0 0 0 0 0 1 0 1 1 0 1 0 0 1 -1
0 1 1 0 0 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 -1
1 1 1 0 0 1 1 0 1 0 0...

input:


output:

0
396305
456652
146790
45193
157298
290069
106100
444511
21734
496244
290946
448070
521134
597482
523834
252545
359818
556162
571923
74738
478958
576152
13164
3449
20598
191933
480791
549865
358479
85064
194758
230237
199091
240511
264959
272630
506097
508042
437901
345079
203449
238730
170044
35181...

result:

ok 2000 lines

Test #4:

score: 6
Accepted
time: 82ms
memory: 15308kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -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:

-1
0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 0 1 1 -1
1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 -1
1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 -1
0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -1
1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 0 1 1 0 0 1 1 1 1...

input:


output:

0
3448
958
4288
8681
336
148
3141
6232
8253
676
8417
4301
7395
2583
2332
1931
5600
7707
6421
1048
3951
3221
1394
6384
4563
4421
2439
5778
5223
3112
7250
7987
2207
564
5006
4104
2143
1953
2367
3895
5571
5608
8505
3836
8925
1735
5333
2756
2154
3381
4181
7200
9010
3640
5480
3088
5385
4089
2931
8673
454...

result:

ok 2000 lines

Test #5:

score: 6
Accepted
time: 3ms
memory: 4188kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -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:

-1
0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 -1
0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 -1
0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 -1
0 0 0 0 0 0 0 1 1 1 0...

input:


output:

0
45
26
35
27
44
28
19
40
28
26
24
33
56
20
33
32
45
13
24
29
34
20
30
35
52
33
35
22
45
32
42
29
33
35
53
35
11
53
28
28
44
32
46
39
39
56
87
36
18
28
37
38
40
52
36
36
33
36
32
36
26
30
37
31
38
43
7
50
24
48
40
37
48
37
27
37
43
47
43
32
31
31
43
35
40
51
37
45
37
15
25
34
40
34
23
34
38
33
54

result:

ok 100 lines

Test #6:

score: 6
Accepted
time: 21ms
memory: 5828kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -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:

-1
0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 1 -1
1 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 0 1 0 0 -1
1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 -1
1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 -1
1 0 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 1 0 -1
0 0 0 1 0 1 1 1 1 0 0...

input:


output:

0
170
114
124
149
133
109
128
102
102
129
94
138
137
50
153
93
92
127
100
145
136
112
155
172
104
114
132
136
140
139
111
135
24
74
117
99
115
107
87
138
96
76
174
132
110
101
134
128
99
93
82
128
94
102
97
123
160
116
151
104
84
98
220
145
126
144
74
132
148
81
103
138
161
133
88
81
127
122
167
102...

result:

ok 2000 lines

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 8
Accepted
time: 1ms
memory: 3956kb

input:

1 1 1 1 1 1 1 1 1 -1
-1
-1

output:

-1
1 1 1 1 1 1 1 1 1 -1
-1

input:


output:

0

result:

ok single line: '0'

Test #8:

score: 8
Accepted
time: 14ms
memory: 4216kb

input:

1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 -1
0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 -1
0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 0 0 1 1 1 0 0 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 -1
1 1 0 0 1 1 1 1 0 1 1 1 0 1 0 1 1 1...

output:

-1
0 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 -1
1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 1 1 1 1 1 -1
1 0 1 0 0 0 0 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1...

input:


output:

0
128264
331628
384182
208153
525372
572423
144082
259414
406719
308409
557889
129397
285792
216221
486927
571225
149599
317887
440746
229109
307465
104346
97136
445388
611196
462442
152511
595507
317479
409647
118010
508691
325383
250598
85753
552333
387494
470667
87406
390547
180339
101478
64178
2...

result:

ok 2000 lines

Test #9:

score: 0
Wrong Answer
time: 2ms
memory: 3964kb

input:

0 1 1 1 1 1 1 0 1 -1
1 0 1 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 -1
1 1 1 1 0 1 1 1 1 -1
1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 1 0 0 1 0 0 0 0 0 1 0 -1
0 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 -1
0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 -1
0 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 0 0 0 1 0 0 0 1 0 0 1 -1
1 0 1 1...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 0 -1
1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 0 0 0 0 1 0 -1
0 1 1 1 0 1 0 0 1 -1
1 1 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 1 1 ...

input:


output:

0
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
34041
1061109567
1061109567
106110...

result:

wrong answer 2nd lines differ - expected: '146596', found: '1061109567'

Subtask #3:

score: 0
Wrong Answer

Test #14:

score: 0
Wrong Answer
time: 2ms
memory: 3960kb

input:

1 0 0 1 1 1 0 0 1 -1
0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 -1
0 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 -1
0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 1 0 0 0 1 -1
0 1 1 0 1 0 1 1 0 -1
0 1 0 1 0 0 1 1 1 -1
0 0 0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 1 1 0 0 0 1 -1
0 1 1 0 1 0 0 1 1 1 1 0 1 0 1 0 1 1 0 1 -1
1 1 ...

output:

-1
1 1 0 1 0 0 1 0 1 -1
0 0 1 1 0 1 1 0 0 -1
0 1 1 1 0 0 1 1 0 -1
0 1 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 1 1 1 1 -1
1 1 1 0 1 1 1 0 1 1 1 0 1 0 0 0 1 1 1 0 -1
0 1 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 -1
1 1 0 1 0 0 1 0 0 -1
1 0 1 0 0 1 1 0 0 -1
1 0 0 0 1 0 0 0 0 -1
1 0 0 0 1 1 1 1 1 0 0 0 ...

input:


output:

0
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
392
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
10611095...

result:

wrong answer 2nd lines differ - expected: '3328', found: '1061109567'

Subtask #4:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 1ms
memory: 3924kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 0 1 0 1 0 1 1 -1
0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 -1
1 0 1 1 1 0 1 0 0 -1
0 1 1 1 1 0 0 0 0 -1
0 1 0 0 1 0 0 0 1 -1
0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 0 0 1 0 0 0 1 0 0 -1
0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 -1
0 0 0 0 0...

output:

-1
0 1 0 0 1 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0 -1
0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 1 -1
0 0 0 1 0 1 0 1 1 1 0 1 0 0 0 0 1 0 1 1 -1
0 0 0 1 0 1 0 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 0 0 0 0 1 0 0 -1
0 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 1 1 1 1 -1
0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 1 -1
0 1...

input:


output:

0
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1...

result:

wrong answer 2nd lines differ - expected: '1881', found: '1061109567'

Subtask #5:

score: 0
Wrong Answer

Test #38:

score: 0
Wrong Answer
time: 1ms
memory: 3820kb

input:

0 0 1 0 1 1 1 1 0 -1
0 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
1 0 0 1 0 1 1 0 1 -1
0 1 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 0 0 -1
0 1 1 0 0 1 1 0 1 0 0 0 0 1 0 0 0 1 1 1 -1
0 1 0 1 1 1 1 0 1 1 0 0 1 0 0 0 0 0 1 1 -1
0 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 1 0 0 0 -1
0 1 ...

output:

-1
1 1 1 1 1 1 1 1 1 -1
1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 -1
0 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 0 1 0 0 -1
0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 -1
1 1 0 1 0 0 0 1 0 -1
1 0 1 1 1 0 1 1 1 -1
1 0 1 1 1 1 0 0 0 -1
1 0 0 1 1 1 1 0 0 -1
0 1 0 0 1 0 1 1 1 -1
0 0 1 1 0 0 1 1 1 -1
0 1...

input:


output:

0
1061109567
1061109567
1061109567
7329
1061109567
7406
1061109567
1061109567
1061109567
1061109567
1061109567
4539
1061109567
9071
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
5167
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
5130
1061109567
4038...

result:

wrong answer 2nd lines differ - expected: '3467', found: '1061109567'

Subtask #6:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 1ms
memory: 4200kb

input:

1 1 1 1 1 1 1 1 1 -1
1 1 1 1 1 1 1 1 1 -1
0 0 0 1 0 1 1 0 0 -1
0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 1 0 -1
0 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 -1
0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 -1
0 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 -1
0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 -1
0 1 ...

output:

-1
0 1 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 -1
0 1 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 -1
0 1 1 0 1 1 0 0 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 1 0 0 1 1 1 0 -1
0 0 1 0 0 0 1 1 1 -1
1 0 1 1 0 0 1 0 0 -1
0 1 0 0 1 0 1 0 1 -1
0 1 0 1 1 0 1 1 1 -1
0 1 0 1 1 1 0 0 1 -1
0 1...

input:


output:

0
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
4393
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109...

result:

wrong answer 2nd lines differ - expected: '4745', found: '1061109567'

Subtask #7:

score: 0
Wrong Answer

Test #64:

score: 16
Accepted
time: 4ms
memory: 4376kb

input:

1 1 1 1 1 0 0 0 0 -1
1 0 0 0 1 1 1 0 1 0 0 1 0 0 0 1 1 1 1 0 -1
1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 1 -1
0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 -1
1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 -1
0 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 -1
0 0 0 0 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 -1
1 1 1 0 1 1 1 0 0 1 0...

output:

-1
1 1 1 1 1 0 0 1 1 -1
1 1 1 1 1 0 0 1 1 -1
1 1 1 1 1 0 0 1 1 -1
1 0 0 0 1 0 1 0 0 -1
1 1 0 1 0 1 1 0 1 -1
0 1 0 0 1 0 1 1 0 -1
1 1 1 1 0 1 0 0 1 -1
0 1 1 1 1 1 0 1 1 -1
1 1 0 0 1 0 0 0 1 -1
1 1 1 1 0 0 1 1 0 -1
1 1 1 0 0 1 1 1 0 -1
1 1 0 1 0 1 1 1 0 -1
1 1 1 0 1 0 1 0 0 -1
1 1 0 0 0 1 1 0 1 -1
1 1...

input:


output:

0
25855
513884
451446
379664
463677
147972
259014
115396
537065
61376
510191
95200
328777
282337
199131
72153
405843
215292
529082
413220
99569
275396
215884
52889
281825
182731
64473
510973
545141
417123
190844
319517
483688
15462
490221
521781
384795
539004
457181
146029
122086
1730
31958
265013
7...

result:

ok 2000 lines

Test #65:

score: 16
Accepted
time: 149ms
memory: 22188kb

input:

0 0 0 1 0 1 1 1 1 -1
0 0 0 0 1 0 1 0 1 -1
0 0 0 0 0 1 1 1 1 -1
0 0 0 0 0 1 0 0 1 -1
0 0 0 0 0 0 1 1 1 -1
0 0 0 0 1 1 0 1 0 -1
0 0 0 0 1 1 0 0 1 -1
0 0 0 0 1 0 1 0 0 -1
0 0 0 0 0 1 1 1 0 -1
0 0 0 0 0 1 0 0 0 -1
0 0 0 0 1 0 1 1 1 -1
0 0 0 0 1 0 0 0 1 -1
0 0 0 0 1 1 0 1 1 -1
0 0 0 0 1 0 1 1 0 -1
0 0 0 ...

output:

-1
0 0 0 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 1 1 0 -1
1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 -1
1 0 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 -1
0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 -1
0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 -1
0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 1 -1
1 1 1 0 1 0 1 1 1 0 1...

input:


output:

0
6187
1398
17
6163
4742
4598
2337
2237
6475
6001
5268
2245
6132
4925
1482
4253
1962
6642
2449
2704
3396
5449
2492
706
835
1879
3203
6855
4265
546
1231
2390
2300
4651
1353
1673
6724
6753
360
4275
6749
3400
1385
2945
6010
5339
226
2511
4558
1033
4708
4330
1882
1185
3535
5071
3843
1252
110
6571
6727
3...

result:

ok 2000 lines

Test #66:

score: 16
Accepted
time: 155ms
memory: 20316kb

input:

0 0 0 0 0 0 1 1 0 -1
1 1 1 0 1 1 1 0 0 1 0 0 0 0 0 1 1 1 0 0 -1
0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 1 0 0 0 0 1 0 0 1 0 -1
0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 -1
0 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 1 0 0 0 0 1 1 0 1 0 0 -1
0 0 0 0 0 0 0 1 1 1 0 1 1 0 0 1 0 1 1 1 0 0 0 1 0 1 1...

output:

-1
0 0 1 0 1 0 1 0 0 -1
0 0 0 0 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 -1
0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 1 -1
0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 -1
0 0 0 0 0 0 1 0 1 0 1 1 1 0 1 1 1 0 1 0 0 0 0 1 0 1 0 1 1 -1
0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 ...

input:


output:

0
5455
4313
3996
4463
4115
2413
1141
7939
4669
5854
7806
7612
3394
7713
441
4956
1630
751
2070
4241
6754
3518
3736
3158
549
4590
6798
842
1597
7637
3679
6104
7953
5654
3951
1877
2075
5983
6633
5724
2967
2362
527
7670
3759
3471
4089
508
1187
5437
3533
3003
7429
7499
5966
7484
949
1545
1862
542
3370
1...

result:

ok 2000 lines

Test #67:

score: 0
Wrong Answer
time: 0ms
memory: 4068kb

input:

1 1 1 1 1 1 1 1 1 -1
0 1 1 0 1 1 0 0 1 -1
0 1 1 0 1 0 0 1 0 -1
0 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 0 1 1 1 0 1 0 0 -1
0 1 1 0 0 1 0 0 0 -1
0 0 1 0 1 1 0 1 0 -1
0 0 0 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 0 0 1 1 1 0 0 0 1 -1
0 1 1 1 1 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 -1
0 1 0 1 1 1 0 0 1 0 1 0 0 0 1 ...

output:

-1
0 0 0 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 1 1 1 -1
1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 1 1 1 -1
1 0 0 0 0 1 1 1 1 1 0 0 1 0 0 1 1 1 0 1 -1
0 1 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 1 1 1 0 -1
0 1 0 0 1 0 0 1 0 1 1 0 0 0 1 0 0 0 0 0 -1
0 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 -1
1 1...

input:


output:

0
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1061109567
1...

result:

wrong answer 2nd lines differ - expected: '79964', found: '1061109567'