QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#628706#7721. Flow ProblemPlentyOfPenalty#AC ✓16ms3848kbC++233.6kb2024-10-10 21:48:252024-10-10 21:48:39

Judging History

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

  • [2024-10-10 21:48:39]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:3848kb
  • [2024-10-10 21:48:25]
  • 提交

answer

#include <bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) begin(x), end(x)
#ifdef memset0
#define log(...) fprintf(stderr, __VA_ARGS__)
#else
#define endl '\n'
#define log(...) (void(0))
#endif
using namespace std;
using ll = long long;
using lf = long double;
using ull = unsigned long long;
const int N = 4005;
const int Lim_N = 1000;
const int Lim_T = 2002;
// const int Lim_N = 15;
// const int Lim_T = 32;
int TEST;
struct sta {
  int x, n;
} pb[N], tar;
struct pos {
  int x, y;
} nw, res[N];
int sz;
pos Next(pos p, sta s, int t) {
  if (p.x == s.x) {
    p.y = (p.y + t) % (s.n << 1);
    if (p.y >= s.n) p.x ^= 1, p.y = (s.n << 1) - 1 - p.y;
  } else {
    p.y = (s.n << 1) - 1 - p.y;
    p.y = (p.y + t) % (s.n << 1);
    if (p.y >= s.n) p.y = (s.n << 1) - 1 - p.y;
    else
      p.x ^= 1;
  }
  return p;
}
#define Ind(P) (P.x * Lim_N + P.y);
int vis[N], TIM, cnt[N], fl[N];
int mns;
string tmp;
int Get_best(pos p, int flg) {
  // log("GETBEST %d %d %d\n", p.x, p.y, flg);
  mns = sz;
  int mni = 1, mx, ind, tg;
  for (int i = 1; i <= Lim_T; ++i) {
    // log("---------------i=%d\n", i);
    ++TIM;
    mx = 0;
    tg = 1;
    // log("sz=%d\n", sz);
    for (int j = 1; j <= sz; ++j) {
      res[j] = Next(p, pb[j], i);
      ind = Ind(res[j]);
      // log("INDof (%d,%d)=%d %d\n", pb[j].n, pb[j].x, res[j].x, res[j].y);
      if (vis[ind] != TIM) {
        vis[ind] = TIM;
        cnt[ind] = 0;
        fl[ind] = pb[j].x;
      }
      ++cnt[ind];
      if (fl[ind] != pb[j].x) tg = 0;
      mx = max(mx, cnt[ind]);
    }
    // log("STEP=%d,mx=%d,tg=%d\n", i, mx, tg);
    if (flg && !tg) continue;
    if (mx <= mns) {
      mns = mx;
      mni = i;
    }
  }
  return mni;
}
void Do(int t) {
  cout << "wait " << t << "\n" << flush;
  pos to;
  if (!TEST) {
    cin >> tmp;
    cin >> to.x >> to.y;
  } else {
    to = Next(nw, tar, t);
    log("TO %d %d\n", to.x, to.y);
  }
  int tsz = 0;
  for (int i = 1; i <= sz; ++i) {
    if (pb[i].n <= to.y) continue;
    res[i] = Next(nw, pb[i], t);
    // log("RES %d=%d %d\n", i, res[i].x, res[i].y);
    if (res[i].x == to.x && res[i].y == to.y) {
      // log("FIND %d %d\n", pb[i].x, pb[i].n);
      pb[++tsz] = pb[i];
    }
  }
  sz = tsz;
  nw = to;
  assert(sz);
}
void Switch() {
  cout << "switch\n" << flush;
  pos to;
  if (!TEST) {
    cin >> tmp;
    cin >> to.x >> to.y;
  } else {
    to = nw;
    to.x ^= 1;
    log("TO %d %d\n", to.x, to.y);
  }
  nw = to;
}
void End(string s) {
  cout << s << "\n" << flush;
  if (!TEST) {
    cin >> tmp;
  } else {
    tmp = "yes";
  }
}
int dir, n;
int main() {
#ifdef memset0
  // freopen("F.in", "r", stdin);
  cin >> tar.x >> tar.n;
  TEST = 1;
#endif
  // cin.tie(0)->sync_with_stdio(0);
  cin >> nw.x >> nw.y;
  for (int i = max(2, nw.y + 1); i <= Lim_N; ++i) {
    pb[++sz] = (sta){0, i};
    pb[++sz] = (sta){1, i};
  }
  Do(Get_best(nw, 0));
  Do(Get_best(nw, 1));
  dir = pb[1].x;
  for (int i = 1; i <= sz; ++i) assert(pb[i].x == dir);
  if (dir == nw.x) Switch();
  Do(nw.y);
  End("left");
  assert(tmp[0] == 'y');
  cin >> nw.x >> nw.y;
  int tsz = 0;
  for (int i = 1; i <= sz; ++i) {
    if (pb[i].n <= nw.y) continue;
    pb[++tsz] = pb[i];
  }
  sz = tsz;
  int tpos = Get_best((pos){nw.x ^ 1, nw.y}, 0);
  int tmn = mns;
  int npos = Get_best(nw, 0);
  if (tmn < mns) {
    mns = tmn;
    npos = tpos;
    Switch();
  }
  log("REM=%d\n", mns);
  Do(npos);
  assert(sz == 1);
  n = pb[1].n;
  if (dir == nw.x) Do(n - 1 - nw.y);
  else
    Do(nw.y + n);
  End("right");
}

详细

Test #1:

score: 100
Accepted
time: 15ms
memory: 3828kb

input:

0 5
no
0 8
no
0 10
no
0 0
yes
1 2
no
1 4
no
1 19
yes

output:

wait 1477
wait 1998
wait 10
left
wait 2002
wait 15
right

result:

ok OK

Test #2:

score: 0
Accepted
time: 14ms
memory: 3608kb

input:

1 0
no
0 0
no
0 0
no
0 0
yes
1 0
no
0 1
no
1 1
yes

output:

wait 1387
wait 1940
wait 0
left
wait 2002
wait 3
right

result:

ok OK

Test #3:

score: 0
Accepted
time: 14ms
memory: 3640kb

input:

0 0
no
0 1
no
1 1
no
0 1
no
0 0
yes
0 0
no
1 1
no
1 1
yes

output:

wait 1387
wait 1939
switch
wait 1
left
wait 2002
wait 0
right

result:

ok OK

Test #4:

score: 0
Accepted
time: 15ms
memory: 3548kb

input:

1 2
no
0 2
no
0 0
no
1 0
no
1 0
yes
0 0
no
1 1
no
0 2
yes

output:

wait 1487
wait 2002
switch
wait 0
left
wait 2002
wait 4
right

result:

ok OK

Test #5:

score: 0
Accepted
time: 11ms
memory: 3792kb

input:

1 0
no
0 0
no
0 2
no
1 2
no
1 0
yes
1 2
no
0 1
no
0 2
yes

output:

wait 1387
wait 1940
switch
wait 2
left
wait 2002
wait 1
right

result:

ok OK

Test #6:

score: 0
Accepted
time: 14ms
memory: 3828kb

input:

1 2
no
1 3
no
0 3
no
1 3
no
1 0
yes
0 2
no
1 3
no
0 3
yes

output:

wait 1487
wait 1799
switch
wait 3
left
wait 2002
wait 7
right

result:

ok OK

Test #7:

score: 0
Accepted
time: 15ms
memory: 3600kb

input:

1 3
no
1 2
no
1 3
no
0 3
no
0 0
yes
1 3
no
0 2
no
1 3
yes

output:

wait 1487
wait 1793
switch
wait 3
left
wait 2002
wait 6
right

result:

ok OK

Test #8:

score: 0
Accepted
time: 10ms
memory: 3604kb

input:

0 0
no
1 2
no
1 2
no
1 0
yes
1 2
no
1 0
no
0 4
yes

output:

wait 1387
wait 1900
wait 2
left
wait 2002
wait 5
right

result:

ok OK

Test #9:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

1 0
no
0 2
no
0 2
no
0 0
yes
1 4
no
0 3
no
1 4
yes

output:

wait 1387
wait 1900
wait 2
left
wait 2002
wait 8
right

result:

ok OK

Test #10:

score: 0
Accepted
time: 11ms
memory: 3840kb

input:

1 3
no
1 2
no
0 4
no
0 0
yes
0 1
no
0 3
no
1 5
yes

output:

wait 1487
wait 1793
wait 4
left
wait 2002
wait 9
right

result:

ok OK

Test #11:

score: 0
Accepted
time: 11ms
memory: 3700kb

input:

1 3
no
1 4
no
1 2
no
1 0
yes
0 2
no
0 0
no
0 5
yes

output:

wait 1487
wait 1802
wait 2
left
wait 2002
wait 5
right

result:

ok OK

Test #12:

score: 0
Accepted
time: 14ms
memory: 3616kb

input:

0 1
no
1 3
no
1 0
no
1 0
yes
0 2
no
0 2
no
0 6
yes

output:

wait 1031
wait 1445
wait 0
left
wait 2002
wait 4
right

result:

ok OK

Test #13:

score: 0
Accepted
time: 14ms
memory: 3836kb

input:

1 4
no
0 4
no
1 6
no
0 6
no
0 0
yes
1 4
no
1 4
no
1 6
yes

output:

wait 1489
wait 1985
switch
wait 6
left
wait 2002
wait 2
right

result:

ok OK

Test #14:

score: 0
Accepted
time: 14ms
memory: 3632kb

input:

0 3
no
0 2
no
0 3
no
1 3
no
1 0
yes
0 2
no
0 4
no
0 7
yes

output:

wait 1487
wait 1793
switch
wait 3
left
wait 2002
wait 3
right

result:

ok OK

Test #15:

score: 0
Accepted
time: 12ms
memory: 3664kb

input:

0 7
no
1 7
no
1 6
no
0 6
no
0 0
yes
0 5
no
0 3
no
1 7
yes

output:

wait 1391
wait 1839
switch
wait 6
left
wait 2002
wait 11
right

result:

ok OK

Test #16:

score: 0
Accepted
time: 10ms
memory: 3492kb

input:

0 1
no
1 3
no
1 8
no
0 8
no
0 0
yes
0 2
no
1 1
no
1 8
yes

output:

wait 1031
wait 1445
switch
wait 8
left
wait 2002
wait 7
right

result:

ok OK

Test #17:

score: 0
Accepted
time: 14ms
memory: 3800kb

input:

0 8
no
0 3
no
1 2
no
0 2
no
0 0
yes
1 6
no
0 7
no
1 8
yes

output:

wait 1391
wait 1950
switch
wait 2
left
wait 2002
wait 16
right

result:

ok OK

Test #18:

score: 0
Accepted
time: 15ms
memory: 3536kb

input:

1 3
no
0 9
no
0 5
no
0 0
yes
1 1
no
1 3
no
1 9
yes

output:

wait 1487
wait 1944
wait 5
left
wait 2002
wait 6
right

result:

ok OK

Test #19:

score: 0
Accepted
time: 15ms
memory: 3800kb

input:

1 2
no
0 4
no
0 6
no
1 6
no
1 0
yes
1 8
no
0 9
no
0 9
yes

output:

wait 1487
wait 2002
switch
wait 6
left
wait 1998
wait 0
right

result:

ok OK

Test #20:

score: 0
Accepted
time: 15ms
memory: 3668kb

input:

1 46
no
1 43
no
0 24
no
1 24
no
1 0
yes
0 41
no
0 43
no
0 49
yes

output:

wait 1103
wait 1968
switch
wait 24
left
wait 2002
wait 6
right

result:

ok OK

Test #21:

score: 0
Accepted
time: 14ms
memory: 3672kb

input:

0 62
no
1 20
no
1 62
no
0 62
no
0 0
yes
0 66
no
0 14
no
1 74
yes

output:

wait 1133
wait 1692
switch
wait 62
left
wait 2002
wait 89
right

result:

ok OK

Test #22:

score: 0
Accepted
time: 15ms
memory: 3656kb

input:

0 19
no
0 66
no
0 65
no
0 0
yes
1 3
no
1 99
no
1 99
yes

output:

wait 1153
wait 2001
wait 65
left
wait 1896
wait 0
right

result:

ok OK

Test #23:

score: 0
Accepted
time: 12ms
memory: 3596kb

input:

0 52
no
0 113
no
0 3
no
0 0
yes
0 107
no
0 105
no
1 124
yes

output:

wait 1189
wait 1860
wait 3
left
wait 2002
wait 230
right

result:

ok OK

Test #24:

score: 0
Accepted
time: 15ms
memory: 3636kb

input:

0 34
no
0 11
no
1 140
no
1 0
yes
1 61
no
0 140
no
0 149
yes

output:

wait 1177
wait 1948
wait 140
left
wait 2002
wait 9
right

result:

ok OK

Test #25:

score: 0
Accepted
time: 12ms
memory: 3660kb

input:

0 156
no
0 71
no
0 174
no
1 174
no
1 0
yes
1 1
no
1 99
no
0 174
yes

output:

wait 1315
wait 1853
switch
wait 174
left
wait 2002
wait 274
right

result:

ok OK

Test #26:

score: 0
Accepted
time: 15ms
memory: 3608kb

input:

1 38
no
0 50
no
0 48
no
0 0
yes
1 119
no
1 121
no
1 199
yes

output:

wait 1111
wait 2002
wait 48
left
wait 2002
wait 78
right

result:

ok OK

Test #27:

score: 0
Accepted
time: 12ms
memory: 3660kb

input:

0 132
no
0 185
no
0 224
no
1 224
no
1 0
yes
1 216
no
1 14
no
0 224
yes

output:

wait 1403
wait 939
switch
wait 224
left
wait 2002
wait 239
right

result:

ok OK

Test #28:

score: 0
Accepted
time: 7ms
memory: 3664kb

input:

0 178
no
0 119
no
0 121
no
1 121
no
1 0
yes
1 215
no
1 213
no
0 249
yes

output:

wait 1441
wait 2002
switch
wait 121
left
wait 2002
wait 463
right

result:

ok OK

Test #29:

score: 0
Accepted
time: 8ms
memory: 3600kb

input:

0 267
no
1 81
no
0 116
no
0 0
yes
0 244
no
1 107
no
1 274
yes

output:

wait 1999
wait 2002
wait 116
left
wait 2002
wait 167
right

result:

ok OK

Test #30:

score: 0
Accepted
time: 12ms
memory: 3844kb

input:

1 151
no
1 198
no
1 299
no
0 299
no
0 0
yes
0 134
no
1 67
no
1 299
yes

output:

wait 1247
wait 1901
switch
wait 299
left
wait 2002
wait 232
right

result:

ok OK

Test #31:

score: 0
Accepted
time: 9ms
memory: 3804kb

input:

1 258
no
1 307
no
0 290
no
0 0
yes
0 168
no
0 116
no
1 324
yes

output:

wait 1999
wait 2002
wait 290
left
wait 2002
wait 441
right

result:

ok OK

Test #32:

score: 0
Accepted
time: 9ms
memory: 3668kb

input:

0 135
no
0 132
no
0 230
no
0 0
yes
0 113
no
0 211
no
1 349
yes

output:

wait 1403
wait 2002
wait 230
left
wait 2002
wait 561
right

result:

ok OK

Test #33:

score: 0
Accepted
time: 9ms
memory: 3656kb

input:

1 257
no
0 241
no
1 6
no
1 0
yes
1 141
no
0 360
no
0 374
yes

output:

wait 1999
wait 2002
wait 6
left
wait 2002
wait 14
right

result:

ok OK

Test #34:

score: 0
Accepted
time: 9ms
memory: 3540kb

input:

1 230
no
0 354
no
1 43
no
1 0
yes
1 156
no
0 245
no
0 399
yes

output:

wait 1385
wait 2002
wait 43
left
wait 2002
wait 154
right

result:

ok OK

Test #35:

score: 0
Accepted
time: 12ms
memory: 3844kb

input:

0 129
no
1 317
no
1 242
no
0 242
no
0 0
yes
0 37
no
1 264
no
1 424
yes

output:

wait 1297
wait 1625
switch
wait 242
left
wait 2002
wait 160
right

result:

ok OK

Test #36:

score: 0
Accepted
time: 5ms
memory: 3540kb

input:

0 292
no
0 91
no
1 449
no
0 449
no
0 0
yes
1 51
no
1 253
no
1 449
yes

output:

wait 2001
wait 1441
switch
wait 449
left
wait 2002
wait 196
right

result:

ok OK

Test #37:

score: 0
Accepted
time: 13ms
memory: 3664kb

input:

1 90
no
0 292
no
1 28
no
1 0
yes
0 468
no
1 379
no
0 474
yes

output:

wait 1333
wait 1579
wait 28
left
wait 2002
wait 854
right

result:

ok OK

Test #38:

score: 0
Accepted
time: 7ms
memory: 3688kb

input:

0 411
no
0 413
no
0 499
no
1 499
no
1 0
yes
0 24
no
0 26
no
0 499
yes

output:

wait 2002
wait 1086
switch
wait 499
left
wait 2002
wait 473
right

result:

ok OK

Test #39:

score: 0
Accepted
time: 4ms
memory: 3648kb

input:

1 404
no
1 502
no
0 449
no
1 449
no
1 0
yes
0 320
no
0 222
no
0 524
yes

output:

wait 2002
wait 2002
switch
wait 449
left
wait 2002
wait 302
right

result:

ok OK

Test #40:

score: 0
Accepted
time: 14ms
memory: 3700kb

input:

0 119
no
0 20
no
0 275
no
0 0
yes
1 192
no
0 5
no
1 549
yes

output:

wait 1199
wait 1945
wait 275
left
wait 2002
wait 555
right

result:

ok OK

Test #41:

score: 0
Accepted
time: 11ms
memory: 3636kb

input:

1 24
no
1 27
no
1 353
no
1 0
yes
1 163
no
1 461
no
0 574
yes

output:

wait 1147
wait 1974
wait 353
left
wait 2002
wait 1036
right

result:

ok OK

Test #42:

score: 0
Accepted
time: 6ms
memory: 3816kb

input:

0 439
no
1 362
no
0 35
no
0 0
yes
1 448
no
1 50
no
1 599
yes

output:

wait 2002
wait 2002
wait 35
left
wait 2002
wait 549
right

result:

ok OK

Test #43:

score: 0
Accepted
time: 7ms
memory: 3820kb

input:

0 402
no
1 95
no
1 594
no
1 0
yes
1 579
no
0 172
no
0 624
yes

output:

wait 2002
wait 2001
wait 594
left
wait 2002
wait 452
right

result:

ok OK

Test #44:

score: 0
Accepted
time: 8ms
memory: 3660kb

input:

0 305
no
1 395
no
0 202
no
0 0
yes
1 456
no
0 141
no
1 649
yes

output:

wait 2001
wait 2002
wait 202
left
wait 2002
wait 791
right

result:

ok OK

Test #45:

score: 0
Accepted
time: 4ms
memory: 3592kb

input:

0 656
no
1 41
no
0 610
no
1 610
no
1 0
yes
0 192
no
1 505
no
0 674
yes

output:

wait 2002
wait 2002
switch
wait 610
left
wait 2002
wait 1180
right

result:

ok OK

Test #46:

score: 0
Accepted
time: 8ms
memory: 3656kb

input:

0 300
no
1 300
no
0 497
no
0 0
yes
1 463
no
0 334
no
1 699
yes

output:

wait 2001
wait 2002
wait 497
left
wait 2002
wait 1034
right

result:

ok OK

Test #47:

score: 0
Accepted
time: 2ms
memory: 3596kb

input:

0 587
no
1 310
no
0 241
no
1 241
no
1 0
yes
1 87
no
0 464
no
0 724
yes

output:

wait 2002
wait 2002
switch
wait 241
left
wait 2002
wait 260
right

result:

ok OK

Test #48:

score: 0
Accepted
time: 5ms
memory: 3640kb

input:

1 606
no
0 391
no
1 110
no
0 110
no
0 0
yes
0 570
no
0 68
no
1 749
yes

output:

wait 2002
wait 2002
switch
wait 110
left
wait 2002
wait 818
right

result:

ok OK

Test #49:

score: 0
Accepted
time: 7ms
memory: 3584kb

input:

1 335
no
0 763
no
0 311
no
0 0
yes
1 184
no
1 636
no
1 774
yes

output:

wait 2001
wait 2002
wait 311
left
wait 2002
wait 138
right

result:

ok OK

Test #50:

score: 0
Accepted
time: 5ms
memory: 3640kb

input:

1 593
no
1 191
no
0 209
no
1 209
no
1 0
yes
1 758
no
1 356
no
0 799
yes

output:

wait 2002
wait 2001
switch
wait 209
left
wait 2002
wait 1156
right

result:

ok OK

Test #51:

score: 0
Accepted
time: 6ms
memory: 3600kb

input:

0 461
no
0 813
no
1 484
no
1 0
yes
0 220
no
0 572
no
0 824
yes

output:

wait 2002
wait 2002
wait 484
left
wait 2002
wait 252
right

result:

ok OK

Test #52:

score: 0
Accepted
time: 8ms
memory: 3652kb

input:

0 291
no
1 9
no
0 425
no
0 0
yes
1 184
no
1 486
no
1 849
yes

output:

wait 2001
wait 1265
wait 425
left
wait 2002
wait 363
right

result:

ok OK

Test #53:

score: 0
Accepted
time: 2ms
memory: 3620kb

input:

0 713
no
0 461
no
0 209
no
0 0
yes
1 468
no
1 720
no
1 874
yes

output:

wait 2002
wait 2002
wait 209
left
wait 2002
wait 154
right

result:

ok OK

Test #54:

score: 0
Accepted
time: 10ms
memory: 3660kb

input:

1 196
no
0 0
no
1 450
no
1 0
yes
0 511
no
0 713
no
0 899
yes

output:

wait 1997
wait 1349
wait 450
left
wait 2002
wait 186
right

result:

ok OK

Test #55:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

0 0
no
1 0
no
1 0
no
1 0
yes
0 0
no
1 1
no
0 1
yes

output:

wait 1387
wait 1940
wait 0
left
wait 2002
wait 3
right

result:

ok OK

Test #56:

score: 0
Accepted
time: 10ms
memory: 3660kb

input:

1 0
no
0 0
no
0 0
no
0 0
yes
0 1
no
1 0
no
1 1
yes

output:

wait 1387
wait 1940
wait 0
left
wait 2002
wait 1
right

result:

ok OK

Test #57:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

1 993
no
1 991
no
1 989
no
1 0
yes
1 993
no
1 991
no
0 999
yes

output:

wait 2002
wait 2002
wait 989
left
wait 2002
wait 1991
right

result:

ok OK

Test #58:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

1 973
no
1 965
no
1 957
no
1 0
yes
1 973
no
1 965
no
0 996
yes

output:

wait 2002
wait 2002
wait 957
left
wait 2002
wait 1962
right

result:

ok OK

Test #59:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

1 999
no
1 997
no
1 995
no
1 0
yes
1 999
no
1 997
no
0 999
yes

output:

wait 2002
wait 2002
wait 995
left
wait 2002
wait 1997
right

result:

ok OK

Test #60:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

1 998
no
1 996
no
1 994
no
1 0
yes
1 998
no
1 996
no
0 999
yes

output:

wait 2002
wait 2002
wait 994
left
wait 2002
wait 1996
right

result:

ok OK

Test #61:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

0 999
no
0 997
no
0 995
no
0 0
yes
0 999
no
0 997
no
1 999
yes

output:

wait 2002
wait 2002
wait 995
left
wait 2002
wait 1997
right

result:

ok OK

Test #62:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

0 998
no
0 996
no
0 994
no
0 0
yes
0 998
no
0 996
no
1 999
yes

output:

wait 2002
wait 2002
wait 994
left
wait 2002
wait 1996
right

result:

ok OK

Test #63:

score: 0
Accepted
time: 3ms
memory: 3672kb

input:

0 800
no
0 798
no
0 796
no
0 0
yes
0 804
no
0 802
no
1 999
yes

output:

wait 2002
wait 2002
wait 796
left
wait 2002
wait 1802
right

result:

ok OK

Test #64:

score: 0
Accepted
time: 14ms
memory: 3840kb

input:

0 0
no
1 12
no
1 5
no
1 0
yes
0 0
no
0 2
no
0 19
yes

output:

wait 1387
wait 1887
wait 5
left
wait 2002
wait 17
right

result:

ok OK

Test #65:

score: 0
Accepted
time: 15ms
memory: 3840kb

input:

0 4
no
1 4
no
0 10
no
0 0
yes
0 4
no
0 2
no
1 19
yes

output:

wait 1489
wait 1985
wait 10
left
wait 2002
wait 22
right

result:

ok OK

Test #66:

score: 0
Accepted
time: 14ms
memory: 3540kb

input:

1 3
no
1 4
no
0 21
no
1 21
no
1 0
yes
1 3
no
1 17
no
0 23
yes

output:

wait 1487
wait 1802
switch
wait 21
left
wait 2002
wait 41
right

result:

ok OK

Test #67:

score: 0
Accepted
time: 14ms
memory: 3540kb

input:

0 3
no
0 4
no
1 21
no
0 21
no
0 0
yes
0 3
no
0 17
no
1 23
yes

output:

wait 1487
wait 1802
switch
wait 21
left
wait 2002
wait 41
right

result:

ok OK

Test #68:

score: 0
Accepted
time: 15ms
memory: 3844kb

input:

1 6
no
1 29
no
0 29
no
1 29
no
1 0
yes
0 2
no
0 24
no
0 29
yes

output:

wait 1477
wait 1979
switch
wait 29
left
wait 2002
wait 5
right

result:

ok OK

Test #69:

score: 0
Accepted
time: 14ms
memory: 3700kb

input:

0 3
no
0 16
no
1 29
no
0 29
no
0 0
yes
0 3
no
1 18
no
1 29
yes

output:

wait 1487
wait 1966
switch
wait 29
left
wait 2002
wait 11
right

result:

ok OK

Test #70:

score: 0
Accepted
time: 12ms
memory: 3548kb

input:

1 10
no
1 7
no
0 35
no
1 35
no
1 0
yes
1 9
no
1 7
no
0 39
yes

output:

wait 1123
wait 1883
switch
wait 35
left
wait 2002
wait 47
right

result:

ok OK

Test #71:

score: 0
Accepted
time: 14ms
memory: 3828kb

input:

0 13
no
1 7
no
0 21
no
0 0
yes
1 1
no
1 3
no
1 39
yes

output:

wait 1381
wait 1811
wait 21
left
wait 2002
wait 36
right

result:

ok OK

Test #72:

score: 0
Accepted
time: 15ms
memory: 3660kb

input:

1 8
no
0 38
no
1 16
no
1 0
yes
1 4
no
1 18
no
0 47
yes

output:

wait 1391
wait 1865
wait 16
left
wait 2002
wait 66
right

result:

ok OK

Test #73:

score: 0
Accepted
time: 15ms
memory: 3612kb

input:

0 8
no
1 38
no
0 16
no
0 0
yes
1 4
no
0 9
no
1 47
yes

output:

wait 1391
wait 1865
wait 16
left
wait 2002
wait 57
right

result:

ok OK

Test #74:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

1 8
no
1 57
no
0 59
no
1 59
no
1 0
yes
0 4
no
1 33
no
0 59
yes

output:

wait 1391
wait 1797
switch
wait 59
left
wait 2002
wait 93
right

result:

ok OK

Test #75:

score: 0
Accepted
time: 12ms
memory: 3672kb

input:

0 6
no
1 30
no
1 59
no
0 59
no
0 0
yes
0 6
no
0 44
no
1 59
yes

output:

wait 1477
wait 1829
switch
wait 59
left
wait 2002
wait 104
right

result:

ok OK

Test #76:

score: 0
Accepted
time: 14ms
memory: 3604kb

input:

0 3
no
0 50
no
1 40
no
1 0
yes
0 0
no
1 77
no
0 79
yes

output:

wait 1487
wait 1989
wait 40
left
wait 2002
wait 157
right

result:

ok OK

Test #77:

score: 0
Accepted
time: 16ms
memory: 3604kb

input:

1 17
no
0 15
no
1 44
no
1 0
yes
1 2
no
0 79
no
0 79
yes

output:

wait 1153
wait 1860
wait 44
left
wait 2002
wait 0
right

result:

ok OK

Test #78:

score: 0
Accepted
time: 15ms
memory: 3672kb

input:

1 12
no
0 46
no
0 60
no
0 0
yes
1 4
no
1 39
no
1 79
yes

output:

wait 1381
wait 1906
wait 60
left
wait 1795
wait 40
right

result:

ok OK

Test #79:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

0 4
no
0 53
no
0 119
no
1 119
no
1 0
yes
0 4
no
0 119
no
0 119
yes

output:

wait 1489
wait 1986
switch
wait 119
left
wait 1795
wait 0
right

result:

ok OK

Test #80:

score: 0
Accepted
time: 11ms
memory: 3608kb

input:

1 4
no
0 44
no
1 113
no
1 0
yes
1 4
no
0 59
no
0 119
yes

output:

wait 1489
wait 2002
wait 113
left
wait 1984
wait 60
right

result:

ok OK

Test #81:

score: 0
Accepted
time: 15ms
memory: 3572kb

input:

0 8
no
0 57
no
1 59
no
0 59
no
0 0
yes
0 8
no
1 73
no
1 119
yes

output:

wait 1391
wait 1797
switch
wait 59
left
wait 2002
wait 46
right

result:

ok OK

Test #82:

score: 0
Accepted
time: 15ms
memory: 3596kb

input:

1 8
no
0 40
no
0 60
no
0 0
yes
1 8
no
1 119
no
1 119
yes

output:

wait 1391
wait 1900
wait 60
left
wait 1791
wait 0
right

result:

ok OK

Test #83:

score: 0
Accepted
time: 11ms
memory: 3544kb

input:

0 38
no
1 112
no
1 79
no
0 79
no
0 0
yes
0 38
no
1 43
no
1 159
yes

output:

wait 1111
wait 1567
switch
wait 79
left
wait 2002
wait 116
right

result:

ok OK

Test #84:

score: 0
Accepted
time: 11ms
memory: 3824kb

input:

1 39
no
0 137
no
1 159
no
0 159
no
0 0
yes
1 39
no
1 121
no
1 159
yes

output:

wait 1103
wait 1897
switch
wait 159
left
wait 2002
wait 38
right

result:

ok OK

Test #85:

score: 0
Accepted
time: 15ms
memory: 3544kb

input:

1 0
no
0 12
no
0 25
no
0 0
yes
1 4
no
1 6
no
1 49
yes

output:

wait 1387
wait 1887
wait 25
left
wait 2002
wait 43
right

result:

ok OK

Test #86:

score: 0
Accepted
time: 14ms
memory: 3844kb

input:

0 1
no
1 17
no
1 52
no
1 0
yes
1 2
no
0 49
no
0 74
yes

output:

wait 1031
wait 1615
wait 52
left
wait 2002
wait 25
right

result:

ok OK

Test #87:

score: 0
Accepted
time: 14ms
memory: 3608kb

input:

1 1
no
0 29
no
1 50
no
1 0
yes
0 2
no
0 4
no
0 99
yes

output:

wait 1031
wait 1720
wait 50
left
wait 2002
wait 95
right

result:

ok OK

Test #88:

score: 0
Accepted
time: 14ms
memory: 3548kb

input:

0 3
no
1 9
no
1 65
no
1 0
yes
0 5
no
0 124
no
0 124
yes

output:

wait 1487
wait 1944
wait 65
left
wait 1869
wait 0
right

result:

ok OK

Test #89:

score: 0
Accepted
time: 15ms
memory: 3608kb

input:

0 2
no
0 15
no
1 148
no
0 148
no
0 0
yes
1 5
no
0 92
no
1 149
yes

output:

wait 1487
wait 1964
switch
wait 148
left
wait 2002
wait 242
right

result:

ok OK

Test #90:

score: 0
Accepted
time: 11ms
memory: 3652kb

input:

0 0
no
0 13
no
1 124
no
0 124
no
0 0
yes
0 0
no
0 98
no
1 174
yes

output:

wait 1387
wait 1888
switch
wait 124
left
wait 2002
wait 273
right

result:

ok OK

Test #91:

score: 0
Accepted
time: 11ms
memory: 3608kb

input:

0 3
no
1 109
no
0 199
no
1 199
no
1 0
yes
0 1
no
0 3
no
0 199
yes

output:

wait 1487
wait 709
switch
wait 199
left
wait 2002
wait 196
right

result:

ok OK

Test #92:

score: 0
Accepted
time: 15ms
memory: 3616kb

input:

1 4
no
1 143
no
1 224
no
0 224
no
0 0
yes
1 0
no
1 202
no
1 224
yes

output:

wait 1489
wait 981
switch
wait 224
left
wait 2002
wait 22
right

result:

ok OK

Test #93:

score: 0
Accepted
time: 14ms
memory: 3696kb

input:

0 0
no
1 112
no
1 110
no
1 0
yes
1 2
no
1 125
no
0 249
yes

output:

wait 1387
wait 2002
wait 110
left
wait 1877
wait 375
right

result:

ok OK

Test #94:

score: 0
Accepted
time: 11ms
memory: 3792kb

input:

1 1
no
0 67
no
1 274
no
0 274
no
0 0
yes
1 0
no
0 197
no
1 274
yes

output:

wait 1031
wait 1992
switch
wait 274
left
wait 2002
wait 472
right

result:

ok OK

Test #95:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

1 0
no
1 187
no
1 299
no
0 299
no
0 0
yes
0 1
no
1 200
no
1 299
yes

output:

wait 1387
wait 1912
switch
wait 299
left
wait 2002
wait 99
right

result:

ok OK

Test #96:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

1 1
no
1 270
no
1 218
no
1 0
yes
0 3
no
0 55
no
0 324
yes

output:

wait 1031
wait 2002
wait 218
left
wait 2002
wait 269
right

result:

ok OK

Test #97:

score: 0
Accepted
time: 14ms
memory: 3548kb

input:

0 2
no
0 89
no
1 175
no
1 0
yes
1 2
no
1 100
no
0 349
yes

output:

wait 1487
wait 1835
wait 175
left
wait 2002
wait 450
right

result:

ok OK

Test #98:

score: 0
Accepted
time: 13ms
memory: 3668kb

input:

1 0
no
0 112
no
0 360
no
0 0
yes
1 0
no
0 247
no
1 374
yes

output:

wait 1387
wait 2002
wait 360
left
wait 2002
wait 622
right

result:

ok OK

Test #99:

score: 0
Accepted
time: 14ms
memory: 3604kb

input:

0 2
no
0 115
no
0 200
no
0 0
yes
1 2
no
0 395
no
1 399
yes

output:

wait 1487
wait 715
wait 200
left
wait 2002
wait 795
right

result:

ok OK

Test #100:

score: 0
Accepted
time: 11ms
memory: 3544kb

input:

0 0
no
0 313
no
1 424
no
0 424
no
0 0
yes
1 2
no
1 304
no
1 424
yes

output:

wait 1387
wait 1588
switch
wait 424
left
wait 2002
wait 120
right

result:

ok OK

Test #101:

score: 0
Accepted
time: 15ms
memory: 3608kb

input:

0 5
no
0 328
no
1 449
no
0 449
no
0 0
yes
0 5
no
1 196
no
1 449
yes

output:

wait 1477
wait 1678
switch
wait 449
left
wait 2002
wait 253
right

result:

ok OK

Test #102:

score: 0
Accepted
time: 16ms
memory: 3600kb

input:

0 2
no
0 415
no
1 474
no
0 474
no
0 0
yes
0 0
no
1 101
no
1 474
yes

output:

wait 1487
wait 1840
switch
wait 474
left
wait 2002
wait 373
right

result:

ok OK

Test #103:

score: 0
Accepted
time: 14ms
memory: 3636kb

input:

0 1
no
0 32
no
1 250
no
1 0
yes
0 2
no
0 4
no
0 499
yes

output:

wait 1031
wait 1717
wait 250
left
wait 2002
wait 495
right

result:

ok OK

Test #104:

score: 0
Accepted
time: 15ms
memory: 3640kb

input:

1 2
no
0 434
no
0 211
no
1 211
no
1 0
yes
1 5
no
1 103
no
0 524
yes

output:

wait 1487
wait 1877
switch
wait 211
left
wait 2002
wait 628
right

result:

ok OK

Test #105:

score: 0
Accepted
time: 11ms
memory: 3664kb

input:

0 5
no
1 371
no
1 173
no
0 173
no
0 0
yes
1 2
no
0 195
no
1 549
yes

output:

wait 1477
wait 2002
switch
wait 173
left
wait 2002
wait 745
right

result:

ok OK

Test #106:

score: 0
Accepted
time: 11ms
memory: 3816kb

input:

0 5
no
1 321
no
0 304
no
0 0
yes
0 5
no
0 303
no
1 574
yes

output:

wait 1477
wait 1674
wait 304
left
wait 2002
wait 878
right

result:

ok OK

Test #107:

score: 0
Accepted
time: 15ms
memory: 3700kb

input:

1 2
no
1 289
no
0 300
no
0 0
yes
0 1
no
0 399
no
1 599
yes

output:

wait 1487
wait 1810
wait 300
left
wait 2002
wait 999
right

result:

ok OK

Test #108:

score: 0
Accepted
time: 14ms
memory: 3624kb

input:

0 2
no
1 234
no
1 511
no
0 511
no
0 0
yes
1 0
no
0 497
no
1 624
yes

output:

wait 1487
wait 1527
switch
wait 511
left
wait 2002
wait 1122
right

result:

ok OK

Test #109:

score: 0
Accepted
time: 15ms
memory: 3668kb

input:

0 5
no
1 171
no
0 426
no
0 0
yes
0 0
no
0 598
no
1 649
yes

output:

wait 1477
wait 2002
wait 426
left
wait 2002
wait 1248
right

result:

ok OK

Test #110:

score: 0
Accepted
time: 12ms
memory: 3544kb

input:

1 5
no
1 132
no
0 225
no
0 0
yes
1 1
no
1 653
no
1 674
yes

output:

wait 1477
wait 992
wait 225
left
wait 2002
wait 21
right

result:

ok OK

Test #111:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

0 2
no
1 84
no
1 524
no
0 524
no
0 0
yes
1 4
no
1 606
no
1 699
yes

output:

wait 1487
wait 1840
switch
wait 524
left
wait 2002
wait 93
right

result:

ok OK

Test #112:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

0 3
no
1 33
no
1 585
no
0 585
no
0 0
yes
0 3
no
1 548
no
1 724
yes

output:

wait 1487
wait 2002
switch
wait 585
left
wait 2002
wait 176
right

result:

ok OK

Test #113:

score: 0
Accepted
time: 14ms
memory: 3548kb

input:

0 1
no
0 470
no
1 31
no
0 31
no
0 0
yes
1 5
no
1 507
no
1 749
yes

output:

wait 1031
wait 2002
switch
wait 31
left
wait 2002
wait 242
right

result:

ok OK

Test #114:

score: 0
Accepted
time: 14ms
memory: 3796kb

input:

0 2
no
0 65
no
1 276
no
0 276
no
0 0
yes
0 3
no
1 448
no
1 774
yes

output:

wait 1487
wait 1892
switch
wait 276
left
wait 2002
wait 326
right

result:

ok OK

Test #115:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

0 1
no
0 570
no
0 168
no
0 0
yes
0 3
no
1 398
no
1 799
yes

output:

wait 1031
wait 2002
wait 168
left
wait 2002
wait 401
right

result:

ok OK

Test #116:

score: 0
Accepted
time: 14ms
memory: 3828kb

input:

0 1
no
0 620
no
0 268
no
0 0
yes
1 5
no
1 357
no
1 824
yes

output:

wait 1031
wait 2002
wait 268
left
wait 2002
wait 467
right

result:

ok OK

Test #117:

score: 0
Accepted
time: 14ms
memory: 3636kb

input:

1 4
no
1 215
no
1 425
no
1 0
yes
0 3
no
0 305
no
0 849
yes

output:

wait 1489
wait 1490
wait 425
left
wait 2002
wait 544
right

result:

ok OK

Test #118:

score: 0
Accepted
time: 14ms
memory: 3656kb

input:

1 5
no
0 267
no
0 178
no
0 0
yes
0 4
no
1 247
no
1 874
yes

output:

wait 1477
wait 1839
wait 178
left
wait 2002
wait 627
right

result:

ok OK

Test #119:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

1 5
no
1 328
no
1 450
no
1 0
yes
0 2
no
0 204
no
0 899
yes

output:

wait 1477
wait 1678
wait 450
left
wait 2002
wait 695
right

result:

ok OK

Test #120:

score: 0
Accepted
time: 11ms
memory: 3612kb

input:

1 1
no
1 4
no
0 7
no
1 7
no
1 0
yes
0 0
no
0 0
no
0 10
yes

output:

wait 1031
wait 1794
switch
wait 7
left
wait 2002
wait 10
right

result:

ok OK

Test #121:

score: 0
Accepted
time: 14ms
memory: 3824kb

input:

0 4
no
1 10
no
1 10
no
0 10
no
0 0
yes
0 9
no
0 9
no
1 10
yes

output:

wait 1489
wait 2002
switch
wait 10
left
wait 2002
wait 20
right

result:

ok OK

Test #122:

score: 0
Accepted
time: 15ms
memory: 3692kb

input:

1 3
no
1 2
no
0 4
no
0 0
yes
0 0
no
1 9
no
1 11
yes

output:

wait 1487
wait 1793
wait 4
left
wait 2002
wait 2
right

result:

ok OK

Test #123:

score: 0
Accepted
time: 15ms
memory: 3600kb

input:

1 6
no
0 6
no
1 5
no
1 0
yes
0 4
no
1 9
no
0 11
yes

output:

wait 1477
wait 1884
wait 5
left
wait 2002
wait 21
right

result:

ok OK

Test #124:

score: 0
Accepted
time: 14ms
memory: 3536kb

input:

1 3
no
1 8
no
1 8
no
0 8
no
0 0
yes
0 3
no
0 3
no
1 12
yes

output:

wait 1487
wait 2002
switch
wait 8
left
wait 2002
wait 16
right

result:

ok OK

Test #125:

score: 0
Accepted
time: 15ms
memory: 3656kb

input:

0 1
no
1 7
no
1 4
no
1 0
yes
1 2
no
1 2
no
0 12
yes

output:

wait 1031
wait 1745
wait 4
left
wait 2002
wait 15
right

result:

ok OK

Test #126:

score: 0
Accepted
time: 11ms
memory: 3612kb

input:

1 2
no
0 0
no
1 13
no
1 0
yes
0 1
no
1 12
no
0 13
yes

output:

wait 1487
wait 2002
wait 13
left
wait 2002
wait 26
right

result:

ok OK

Test #127:

score: 0
Accepted
time: 15ms
memory: 3636kb

input:

0 7
no
1 1
no
1 6
no
1 0
yes
0 2
no
1 11
no
0 13
yes

output:

wait 1391
wait 1871
wait 6
left
wait 2002
wait 25
right

result:

ok OK

Test #128:

score: 0
Accepted
time: 11ms
memory: 3792kb

input:

1 1
no
1 12
no
1 1
no
0 1
no
0 0
yes
1 3
no
0 4
no
1 14
yes

output:

wait 1031
wait 1789
switch
wait 1
left
wait 2002
wait 19
right

result:

ok OK

Test #129:

score: 0
Accepted
time: 15ms
memory: 3660kb

input:

1 11
no
0 5
no
0 13
no
0 0
yes
1 7
no
0 0
no
1 14
yes

output:

wait 1123
wait 2002
wait 13
left
wait 2002
wait 15
right

result:

ok OK

Test #130:

score: 0
Accepted
time: 11ms
memory: 3608kb

input:

0 3
no
1 11
no
1 15
no
0 15
no
0 0
yes
1 3
no
0 10
no
1 15
yes

output:

wait 1487
wait 1956
switch
wait 15
left
wait 2002
wait 26
right

result:

ok OK

Test #131:

score: 0
Accepted
time: 15ms
memory: 3692kb

input:

1 7
no
0 9
no
0 7
no
0 0
yes
0 0
no
0 14
no
1 15
yes

output:

wait 1391
wait 1890
wait 7
left
wait 2002
wait 30
right

result:

ok OK

Test #132:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

1 3
no
0 5
no
0 9
no
0 0
yes
0 0
no
0 4
no
1 16
yes

output:

wait 1487
wait 2002
wait 9
left
wait 2002
wait 21
right

result:

ok OK

Test #133:

score: 0
Accepted
time: 14ms
memory: 3696kb

input:

0 3
no
1 5
no
1 9
no
1 0
yes
0 0
no
1 3
no
0 16
yes

output:

wait 1487
wait 2002
wait 9
left
wait 2002
wait 20
right

result:

ok OK

Test #134:

score: 0
Accepted
time: 15ms
memory: 3596kb

input:

1 3
no
0 7
no
0 13
no
1 13
no
1 0
yes
1 3
no
1 17
no
0 17
yes

output:

wait 1487
wait 1878
switch
wait 13
left
wait 2002
wait 35
right

result:

ok OK

Test #135:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

1 5
no
1 6
no
1 13
no
0 13
no
0 0
yes
0 17
no
1 4
no
1 17
yes

output:

wait 1477
wait 1879
switch
wait 13
left
wait 2002
wait 13
right

result:

ok OK

Test #136:

score: 0
Accepted
time: 14ms
memory: 3600kb

input:

0 3
no
0 8
no
1 3
no
1 0
yes
1 2
no
1 14
no
0 18
yes

output:

wait 1487
wait 2002
wait 3
left
wait 2002
wait 33
right

result:

ok OK

Test #137:

score: 0
Accepted
time: 12ms
memory: 3632kb

input:

1 5
no
1 10
no
0 17
no
1 17
no
1 0
yes
1 0
no
1 12
no
0 18
yes

output:

wait 1477
wait 978
switch
wait 17
left
wait 2002
wait 31
right

result:

ok OK

Test #138:

score: 0
Accepted
time: 14ms
memory: 3828kb

input:

0 0
no
1 12
no
1 5
no
1 0
yes
0 0
no
0 2
no
0 19
yes

output:

wait 1387
wait 1887
wait 5
left
wait 2002
wait 17
right

result:

ok OK

Test #139:

score: 0
Accepted
time: 15ms
memory: 3668kb

input:

1 13
no
0 7
no
0 18
no
1 18
no
1 0
yes
1 9
no
1 7
no
0 19
yes

output:

wait 1381
wait 1811
switch
wait 18
left
wait 2002
wait 27
right

result:

ok OK

Test #140:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

1 1
no
1 20
no
1 5
no
1 0
yes
0 2
no
1 11
no
0 20
yes

output:

wait 1031
wait 1611
wait 5
left
wait 2002
wait 32
right

result:

ok OK

Test #141:

score: 0
Accepted
time: 15ms
memory: 3840kb

input:

1 14
no
0 10
no
1 14
no
1 0
yes
1 20
no
0 7
no
0 20
yes

output:

wait 1117
wait 1991
wait 14
left
wait 2002
wait 13
right

result:

ok OK

Test #142:

score: 0
Accepted
time: 15ms
memory: 3632kb

input:

1 3
no
0 5
no
1 16
no
0 16
no
0 0
yes
0 0
no
1 21
no
1 21
yes

output:

wait 1487
wait 2002
switch
wait 16
left
wait 2002
wait 0
right

result:

ok OK

Test #143:

score: 0
Accepted
time: 15ms
memory: 3720kb

input:

0 17
no
0 8
no
1 21
no
0 21
no
0 0
yes
0 14
no
1 7
no
1 21
yes

output:

wait 1153
wait 1922
switch
wait 21
left
wait 2002
wait 14
right

result:

ok OK

Test #144:

score: 0
Accepted
time: 12ms
memory: 3656kb

input:

1 2
no
0 12
no
1 10
no
1 0
yes
0 2
no
1 19
no
0 22
yes

output:

wait 1487
wait 1955
wait 10
left
wait 2002
wait 42
right

result:

ok OK

Test #145:

score: 0
Accepted
time: 15ms
memory: 3828kb

input:

0 9
no
1 1
no
1 22
no
0 22
no
0 0
yes
0 6
no
1 17
no
1 22
yes

output:

wait 1391
wait 1999
switch
wait 22
left
wait 2002
wait 5
right

result:

ok OK

Test #146:

score: 0
Accepted
time: 14ms
memory: 3828kb

input:

0 0
no
1 4
no
1 8
no
1 0
yes
0 0
no
1 13
no
0 23
yes

output:

wait 1387
wait 1964
wait 8
left
wait 2002
wait 37
right

result:

ok OK

Test #147:

score: 0
Accepted
time: 15ms
memory: 3608kb

input:

1 4
no
1 3
no
0 21
no
1 21
no
1 0
yes
1 12
no
0 21
no
0 23
yes

output:

wait 1489
wait 1801
switch
wait 21
left
wait 2002
wait 2
right

result:

ok OK

Test #148:

score: 0
Accepted
time: 15ms
memory: 3656kb

input:

1 2
no
0 10
no
0 15
no
0 0
yes
1 0
no
1 2
no
1 24
yes

output:

wait 1487
wait 1945
wait 15
left
wait 2002
wait 22
right

result:

ok OK

Test #149:

score: 0
Accepted
time: 15ms
memory: 3604kb

input:

0 17
no
0 20
no
0 22
no
1 22
no
1 0
yes
1 19
no
1 17
no
0 24
yes

output:

wait 1153
wait 2002
switch
wait 22
left
wait 2002
wait 42
right

result:

ok OK

Test #150:

score: 0
Accepted
time: 14ms
memory: 3696kb

input:

1 0
no
1 17
no
0 8
no
1 8
no
1 0
yes
0 0
no
1 25
no
0 25
yes

output:

wait 1387
wait 2002
switch
wait 8
left
wait 2002
wait 51
right

result:

ok OK

Test #151:

score: 0
Accepted
time: 15ms
memory: 3796kb

input:

0 23
no
1 25
no
1 14
no
1 0
yes
1 17
no
0 8
no
0 25
yes

output:

wait 1147
wait 1987
wait 14
left
wait 2002
wait 17
right

result:

ok OK

Test #152:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

0 0
no
1 16
no
1 12
no
1 0
yes
1 0
no
0 3
no
0 26
yes

output:

wait 1387
wait 2002
wait 12
left
wait 2002
wait 23
right

result:

ok OK

Test #153:

score: 0
Accepted
time: 15ms
memory: 3540kb

input:

0 14
no
1 2
no
1 9
no
1 0
yes
0 26
no
1 23
no
0 26
yes

output:

wait 1117
wait 1829
wait 9
left
wait 2002
wait 50
right

result:

ok OK

Test #154:

score: 0
Accepted
time: 15ms
memory: 3840kb

input:

1 2
no
1 27
no
0 3
no
1 3
no
1 0
yes
0 1
no
1 12
no
0 27
yes

output:

wait 1487
wait 1935
switch
wait 3
left
wait 2002
wait 40
right

result:

ok OK

Test #155:

score: 0
Accepted
time: 15ms
memory: 3664kb

input:

0 17
no
1 5
no
0 6
no
1 6
no
1 0
yes
0 18
no
0 4
no
0 27
yes

output:

wait 1153
wait 1916
switch
wait 6
left
wait 2002
wait 23
right

result:

ok OK

Test #156:

score: 0
Accepted
time: 11ms
memory: 3608kb

input:

1 3
no
0 17
no
1 28
no
0 28
no
0 0
yes
1 2
no
0 25
no
1 28
yes

output:

wait 1487
wait 1960
switch
wait 28
left
wait 2002
wait 54
right

result:

ok OK

Test #157:

score: 0
Accepted
time: 15ms
memory: 3796kb

input:

1 27
no
0 11
no
0 28
no
1 28
no
1 0
yes
1 6
no
0 23
no
0 28
yes

output:

wait 1199
wait 1931
switch
wait 28
left
wait 2002
wait 5
right

result:

ok OK

Test #158:

score: 0
Accepted
time: 12ms
memory: 3672kb

input:

0 3
no
0 16
no
1 29
no
0 29
no
0 0
yes
1 1
no
1 23
no
1 29
yes

output:

wait 1487
wait 1966
switch
wait 29
left
wait 2002
wait 6
right

result:

ok OK

Test #159:

score: 0
Accepted
time: 15ms
memory: 3828kb

input:

1 8
no
0 2
no
0 20
no
1 20
no
1 0
yes
0 16
no
1 21
no
0 29
yes

output:

wait 1391
wait 1998
switch
wait 20
left
wait 2002
wait 51
right

result:

ok OK

Test #160:

score: 0
Accepted
time: 14ms
memory: 3612kb

input:

0 3
no
0 50
no
0 119
no
1 119
no
1 0
yes
1 149
no
1 67
no
0 239
yes

output:

wait 1487
wait 1989
switch
wait 119
left
wait 2002
wait 307
right

result:

ok OK

Test #161:

score: 0
Accepted
time: 14ms
memory: 3696kb

input:

1 0
no
1 53
no
1 180
no
1 0
yes
1 0
no
0 81
no
0 239
yes

output:

wait 1387
wait 1793
wait 180
left
wait 2002
wait 158
right

result:

ok OK

Test #162:

score: 0
Accepted
time: 11ms
memory: 3692kb

input:

0 2
no
0 49
no
0 119
no
1 119
no
1 0
yes
1 4
no
1 120
no
0 239
yes

output:

wait 1487
wait 1990
switch
wait 119
left
wait 1804
wait 360
right

result:

ok OK

Test #163:

score: 0
Accepted
time: 8ms
memory: 3656kb

input:

1 265
no
0 135
no
1 66
no
0 66
no
0 0
yes
0 267
no
0 65
no
1 299
yes

output:

wait 1999
wait 2002
switch
wait 66
left
wait 2002
wait 365
right

result:

ok OK

Test #164:

score: 0
Accepted
time: 10ms
memory: 3600kb

input:

1 0
no
1 187
no
1 299
no
0 299
no
0 0
yes
1 1
no
1 203
no
1 299
yes

output:

wait 1387
wait 1912
switch
wait 299
left
wait 2002
wait 96
right

result:

ok OK

Test #165:

score: 0
Accepted
time: 15ms
memory: 3660kb

input:

0 1
no
0 170
no
1 31
no
0 31
no
0 0
yes
1 7
no
1 209
no
1 299
yes

output:

wait 1031
wait 2002
switch
wait 31
left
wait 2002
wait 90
right

result:

ok OK

Test #166:

score: 0
Accepted
time: 15ms
memory: 3672kb

input:

1 32
no
1 7
no
0 127
no
1 127
no
1 0
yes
1 159
no
0 114
no
0 287
yes

output:

wait 1177
wait 1863
switch
wait 127
left
wait 2002
wait 173
right

result:

ok OK

Test #167:

score: 0
Accepted
time: 14ms
memory: 3604kb

input:

1 2
no
0 238
no
1 143
no
0 143
no
0 0
yes
0 2
no
1 271
no
1 287
yes

output:

wait 1487
wait 1534
switch
wait 143
left
wait 2002
wait 16
right

result:

ok OK

Test #168:

score: 0
Accepted
time: 14ms
memory: 3656kb

input:

1 2
no
0 238
no
1 143
no
0 143
no
0 0
yes
1 5
no
1 279
no
1 287
yes

output:

wait 1487
wait 1534
switch
wait 143
left
wait 2002
wait 8
right

result:

ok OK

Test #169:

score: 0
Accepted
time: 14ms
memory: 3848kb

input:

1 46
no
0 48
no
1 168
no
1 0
yes
0 89
no
0 251
no
0 251
yes

output:

wait 1103
wait 1799
wait 168
left
wait 1674
wait 0
right

result:

ok OK

Test #170:

score: 0
Accepted
time: 14ms
memory: 3548kb

input:

0 2
no
0 27
no
0 108
no
0 0
yes
0 2
no
0 126
no
1 251
yes

output:

wait 1487
wait 1935
wait 108
left
wait 1892
wait 378
right

result:

ok OK

Test #171:

score: 0
Accepted
time: 13ms
memory: 3664kb

input:

0 0
no
1 124
no
1 138
no
1 0
yes
1 5
no
1 19
no
0 251
yes

output:

wait 1387
wait 2002
wait 138
left
wait 2002
wait 271
right

result:

ok OK

Test #172:

score: 0
Accepted
time: 10ms
memory: 3604kb

input:

1 82
no
1 5
no
0 179
no
1 179
no
1 0
yes
1 55
no
0 146
no
0 179
yes

output:

wait 1157
wait 1985
switch
wait 179
left
wait 2002
wait 33
right

result:

ok OK

Test #173:

score: 0
Accepted
time: 11ms
memory: 3824kb

input:

1 1
no
1 50
no
0 151
no
1 151
no
1 0
yes
1 2
no
1 160
no
0 179
yes

output:

wait 1031
wait 2002
switch
wait 151
left
wait 2002
wait 340
right

result:

ok OK

Test #174:

score: 0
Accepted
time: 14ms
memory: 3676kb

input:

0 2
no
0 49
no
1 120
no
1 0
yes
1 6
no
0 179
no
0 179
yes

output:

wait 1487
wait 1990
wait 120
left
wait 1986
wait 0
right

result:

ok OK

Test #175:

score: 0
Accepted
time: 13ms
memory: 3540kb

input:

1 100
no
1 89
no
1 279
no
0 279
no
0 0
yes
0 274
no
1 47
no
1 279
yes

output:

wait 1109
wait 1870
switch
wait 279
left
wait 2002
wait 232
right

result:

ok OK

Test #176:

score: 0
Accepted
time: 12ms
memory: 3804kb

input:

0 1
no
1 87
no
0 234
no
1 234
no
1 0
yes
0 0
no
1 237
no
0 279
yes

output:

wait 1031
wait 2002
switch
wait 234
left
wait 2002
wait 517
right

result:

ok OK

Test #177:

score: 0
Accepted
time: 14ms
memory: 3636kb

input:

0 2
no
1 190
no
0 139
no
1 139
no
1 0
yes
1 2
no
1 240
no
0 279
yes

output:

wait 1487
wait 1450
switch
wait 139
left
wait 2002
wait 520
right

result:

ok OK

Test #178:

score: 0
Accepted
time: 11ms
memory: 3828kb

input:

0 162
no
1 106
no
1 269
no
0 269
no
0 0
yes
1 29
no
0 128
no
1 269
yes

output:

wait 1349
wait 1783
switch
wait 269
left
wait 2002
wait 398
right

result:

ok OK

Test #179:

score: 0
Accepted
time: 14ms
memory: 3608kb

input:

0 2
no
1 130
no
0 269
no
1 269
no
1 0
yes
0 2
no
1 155
no
0 269
yes

output:

wait 1487
wait 1480
switch
wait 269
left
wait 2002
wait 425
right

result:

ok OK

Test #180:

score: 0
Accepted
time: 14ms
memory: 3796kb

input:

1 3
no
1 136
no
0 134
no
1 134
no
1 0
yes
1 3
no
1 161
no
0 269
yes

output:

wait 1487
wait 1351
switch
wait 134
left
wait 2002
wait 431
right

result:

ok OK

Test #181:

score: 0
Accepted
time: 9ms
memory: 3800kb

input:

0 140
no
0 237
no
0 263
no
1 263
no
1 0
yes
0 135
no
0 25
no
0 263
yes

output:

wait 1153
wait 1610
switch
wait 263
left
wait 2002
wait 238
right

result:

ok OK

Test #182:

score: 0
Accepted
time: 14ms
memory: 3696kb

input:

1 1
no
1 26
no
1 176
no
1 0
yes
0 1
no
0 263
no
0 263
yes

output:

wait 1031
wait 1962
wait 176
left
wait 1846
wait 0
right

result:

ok OK

Test #183:

score: 0
Accepted
time: 14ms
memory: 3696kb

input:

1 0
no
0 196
no
1 131
no
0 131
no
0 0
yes
1 6
no
0 103
no
1 263
yes

output:

wait 1387
wait 1384
switch
wait 131
left
wait 2002
wait 367
right

result:

ok OK

Test #184:

score: 0
Accepted
time: 13ms
memory: 3608kb

input:

1 89
no
1 52
no
0 105
no
0 0
yes
1 86
no
0 108
no
1 215
yes

output:

wait 1259
wait 2002
wait 105
left
wait 1965
wait 324
right

result:

ok OK

Test #185:

score: 0
Accepted
time: 11ms
memory: 3656kb

input:

1 0
no
1 91
no
0 66
no
0 0
yes
0 2
no
0 160
no
1 215
yes

output:

wait 1387
wait 2002
wait 66
left
wait 2002
wait 376
right

result:

ok OK

Test #186:

score: 0
Accepted
time: 15ms
memory: 3636kb

input:

1 3
no
0 187
no
0 29
no
1 29
no
1 0
yes
1 5
no
1 163
no
0 215
yes

output:

wait 1487
wait 2002
switch
wait 29
left
wait 2002
wait 379
right

result:

ok OK

Test #187:

score: 0
Accepted
time: 14ms
memory: 3636kb

input:

1 70
no
1 69
no
1 167
no
1 0
yes
1 107
no
1 205
no
0 209
yes

output:

wait 1261
wait 2002
wait 167
left
wait 2002
wait 415
right

result:

ok OK

Test #188:

score: 0
Accepted
time: 14ms
memory: 3832kb

input:

1 1
no
1 192
no
1 94
no
0 94
no
0 0
yes
1 0
no
0 97
no
1 209
yes

output:

wait 1031
wait 2002
switch
wait 94
left
wait 2002
wait 307
right

result:

ok OK

Test #189:

score: 0
Accepted
time: 14ms
memory: 3832kb

input:

0 3
no
1 189
no
1 0
no
1 0
yes
1 1
no
1 99
no
0 209
yes

output:

wait 1487
wait 1449
wait 0
left
wait 2002
wait 309
right

result:

ok OK

Test #190:

score: 0
Accepted
time: 14ms
memory: 3640kb

input:

1 37
no
0 65
no
0 167
no
1 167
no
1 0
yes
0 54
no
0 40
no
0 167
yes

output:

wait 1111
wait 1782
switch
wait 167
left
wait 2002
wait 127
right

result:

ok OK

Test #191:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

1 1
no
1 24
no
1 138
no
0 138
no
0 0
yes
0 0
no
0 14
no
1 167
yes

output:

wait 1031
wait 1794
switch
wait 138
left
wait 2002
wait 182
right

result:

ok OK

Test #192:

score: 0
Accepted
time: 14ms
memory: 3608kb

input:

1 2
no
0 140
no
0 67
no
1 67
no
1 0
yes
0 6
no
1 7
no
0 167
yes

output:

wait 1487
wait 1607
switch
wait 67
left
wait 2002
wait 175
right

result:

ok OK

Test #193:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

0 53
no
0 42
no
1 115
no
1 0
yes
0 114
no
1 43
no
0 119
yes

output:

wait 1189
wait 2002
wait 115
left
wait 2002
wait 163
right

result:

ok OK

Test #194:

score: 0
Accepted
time: 8ms
memory: 3660kb

input:

0 0
no
1 52
no
0 59
no
1 59
no
1 0
yes
1 1
no
0 80
no
0 119
yes

output:

wait 1387
wait 1792
switch
wait 59
left
wait 2002
wait 39
right

result:

ok OK

Test #195:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

0 1
no
0 72
no
0 79
no
1 79
no
1 0
yes
0 9
no
0 91
no
0 119
yes

output:

wait 1031
wait 1687
switch
wait 79
left
wait 2002
wait 28
right

result:

ok OK

Test #196:

score: 0
Accepted
time: 14ms
memory: 3844kb

input:

1 73
no
0 57
no
0 43
no
1 43
no
1 0
yes
0 81
no
0 67
no
0 143
yes

output:

wait 1283
wait 2002
switch
wait 43
left
wait 2002
wait 76
right

result:

ok OK

Test #197:

score: 0
Accepted
time: 14ms
memory: 3492kb

input:

1 1
no
0 119
no
0 133
no
0 0
yes
1 0
no
0 13
no
1 143
yes

output:

wait 1031
wait 2002
wait 133
left
wait 2002
wait 157
right

result:

ok OK

Test #198:

score: 0
Accepted
time: 13ms
memory: 3828kb

input:

0 0
no
1 52
no
0 11
no
1 11
no
1 0
yes
1 1
no
1 72
no
0 143
yes

output:

wait 1387
wait 1792
switch
wait 11
left
wait 1945
wait 216
right

result:

ok OK

Test #199:

score: 0
Accepted
time: 8ms
memory: 3544kb

input:

0 170
no
1 88
no
1 95
no
0 95
no
0 0
yes
1 26
no
1 108
no
1 191
yes

output:

wait 1411
wait 1927
switch
wait 95
left
wait 2002
wait 83
right

result:

ok OK

Test #200:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

1 0
no
1 149
no
1 0
no
1 0
yes
1 2
no
0 79
no
0 191
yes

output:

wait 1387
wait 1301
wait 0
left
wait 2002
wait 112
right

result:

ok OK

Test #201:

score: 0
Accepted
time: 14ms
memory: 3636kb

input:

1 2
no
0 46
no
0 64
no
0 0
yes
0 2
no
0 96
no
1 191
yes

output:

wait 1487
wait 1902
wait 64
left
wait 1826
wait 288
right

result:

ok OK

Test #202:

score: 0
Accepted
time: 14ms
memory: 3692kb

input:

0 7
no
1 207
no
1 293
no
0 293
no
0 0
yes
1 213
no
0 136
no
1 293
yes

output:

wait 1391
wait 1850
switch
wait 293
left
wait 2002
wait 430
right

result:

ok OK

Test #203:

score: 0
Accepted
time: 11ms
memory: 3660kb

input:

0 1
no
0 146
no
0 147
no
0 0
yes
1 0
no
1 238
no
1 293
yes

output:

wait 1031
wait 1763
wait 147
left
wait 2002
wait 55
right

result:

ok OK

Test #204:

score: 0
Accepted
time: 13ms
memory: 3672kb

input:

1 0
no
0 210
no
0 293
no
1 293
no
1 0
yes
1 5
no
0 232
no
0 293
yes

output:

wait 1387
wait 1847
switch
wait 293
left
wait 2002
wait 61
right

result:

ok OK

Test #205:

score: 0
Accepted
time: 10ms
memory: 3544kb

input:

0 190
no
1 20
no
0 183
no
1 183
no
1 0
yes
1 150
no
0 195
no
0 275
yes

output:

wait 1997
wait 1860
switch
wait 183
left
wait 2002
wait 80
right

result:

ok OK

Test #206:

score: 0
Accepted
time: 11ms
memory: 3636kb

input:

0 2
no
0 171
no
1 137
no
0 137
no
0 0
yes
0 2
no
0 208
no
1 275
yes

output:

wait 1487
wait 1413
switch
wait 137
left
wait 2002
wait 484
right

result:

ok OK

Test #207:

score: 0
Accepted
time: 14ms
memory: 3828kb

input:

0 1
no
0 74
no
1 271
no
0 271
no
0 0
yes
1 3
no
0 202
no
1 275
yes

output:

wait 1031
wait 2002
switch
wait 271
left
wait 2002
wait 478
right

result:

ok OK

Test #208:

score: 0
Accepted
time: 15ms
memory: 3604kb

input:

1 24
no
0 82
no
0 259
no
1 259
no
1 0
yes
0 136
no
0 58
no
0 259
yes

output:

wait 1147
wait 1737
switch
wait 259
left
wait 2002
wait 201
right

result:

ok OK

Test #209:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

0 0
no
0 173
no
1 129
no
0 129
no
0 0
yes
0 0
no
0 78
no
1 259
yes

output:

wait 1387
wait 1343
switch
wait 129
left
wait 2002
wait 338
right

result:

ok OK

Test #210:

score: 0
Accepted
time: 13ms
memory: 3612kb

input:

0 0
no
0 173
no
1 129
no
0 129
no
0 0
yes
0 0
no
0 78
no
1 259
yes

output:

wait 1387
wait 1343
switch
wait 129
left
wait 2002
wait 338
right

result:

ok OK

Test #211:

score: 0
Accepted
time: 10ms
memory: 3652kb

input:

1 217
no
0 161
no
1 176
no
1 0
yes
0 150
no
1 187
no
0 233
yes

output:

wait 1315
wait 2002
wait 176
left
wait 2002
wait 421
right

result:

ok OK

Test #212:

score: 0
Accepted
time: 11ms
memory: 3664kb

input:

0 2
no
0 85
no
0 215
no
1 215
no
1 0
yes
1 1
no
0 128
no
0 233
yes

output:

wait 1487
wait 2002
switch
wait 215
left
wait 2002
wait 105
right

result:

ok OK

Test #213:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

0 1
no
0 96
no
0 233
no
1 233
no
1 0
yes
1 9
no
0 120
no
0 233
yes

output:

wait 1031
wait 1541
switch
wait 233
left
wait 2002
wait 113
right

result:

ok OK

Test #214:

score: 0
Accepted
time: 15ms
memory: 3656kb

input:

0 18
no
1 226
no
0 51
no
0 0
yes
1 199
no
0 78
no
1 227
yes

output:

wait 1157
wait 2002
wait 51
left
wait 2002
wait 306
right

result:

ok OK

Test #215:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

1 0
no
1 19
no
1 113
no
0 113
no
0 0
yes
1 2
no
1 180
no
1 227
yes

output:

wait 1387
wait 1918
switch
wait 113
left
wait 2002
wait 47
right

result:

ok OK

Test #216:

score: 0
Accepted
time: 14ms
memory: 3636kb

input:

0 3
no
1 115
no
1 56
no
0 56
no
0 0
yes
0 3
no
1 174
no
1 227
yes

output:

wait 1487
wait 1765
switch
wait 56
left
wait 2002
wait 53
right

result:

ok OK

Test #217:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

1 58
no
0 218
no
0 8
no
0 0
yes
0 139
no
1 70
no
1 223
yes

output:

wait 1067
wait 2002
wait 8
left
wait 2002
wait 153
right

result:

ok OK

Test #218:

score: 0
Accepted
time: 11ms
memory: 3536kb

input:

1 2
no
0 140
no
1 44
no
1 0
yes
0 2
no
0 212
no
0 223
yes

output:

wait 1487
wait 1607
wait 44
left
wait 2002
wait 11
right

result:

ok OK

Test #219:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

0 1
no
0 136
no
1 101
no
1 0
yes
1 4
no
0 205
no
0 223
yes

output:

wait 1031
wait 2002
wait 101
left
wait 2002
wait 18
right

result:

ok OK

Test #220:

score: 0
Accepted
time: 7ms
memory: 3532kb

input:

0 372
no
0 393
no
1 495
no
1 0
yes
1 130
no
1 108
no
0 989
yes

output:

wait 2001
wait 1091
wait 495
left
wait 2002
wait 1098
right

result:

ok OK

Test #221:

score: 0
Accepted
time: 13ms
memory: 3552kb

input:

0 0
no
1 592
no
1 570
no
1 0
yes
1 2
no
0 19
no
0 989
yes

output:

wait 1387
wait 2002
wait 570
left
wait 2002
wait 970
right

result:

ok OK

Test #222:

score: 0
Accepted
time: 2ms
memory: 3652kb

input:

0 665
no
0 645
no
0 625
no
0 0
yes
1 917
no
1 937
no
1 990
yes

output:

wait 2002
wait 2002
wait 625
left
wait 2002
wait 53
right

result:

ok OK

Test #223:

score: 0
Accepted
time: 12ms
memory: 3664kb

input:

0 4
no
1 488
no
1 468
no
1 0
yes
0 5
no
0 25
no
0 990
yes

output:

wait 1489
wait 2002
wait 468
left
wait 2002
wait 965
right

result:

ok OK

Test #224:

score: 0
Accepted
time: 15ms
memory: 3840kb

input:

1 34
no
0 772
no
0 754
no
0 0
yes
0 632
no
0 614
no
1 991
yes

output:

wait 1177
wait 2002
wait 754
left
wait 2002
wait 1606
right

result:

ok OK

Test #225:

score: 0
Accepted
time: 14ms
memory: 3664kb

input:

1 4
no
0 490
no
0 496
no
0 0
yes
0 2
no
1 15
no
1 991
yes

output:

wait 1489
wait 1978
wait 496
left
wait 2002
wait 976
right

result:

ok OK

Test #226:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

0 767
no
0 751
no
0 735
no
0 0
yes
0 775
no
0 759
no
1 992
yes

output:

wait 2002
wait 2002
wait 735
left
wait 2002
wait 1752
right

result:

ok OK

Test #227:

score: 0
Accepted
time: 11ms
memory: 3672kb

input:

0 1
no
1 953
no
1 937
no
1 0
yes
0 2
no
0 18
no
0 992
yes

output:

wait 1031
wait 2002
wait 937
left
wait 2002
wait 974
right

result:

ok OK

Test #228:

score: 0
Accepted
time: 2ms
memory: 3640kb

input:

0 844
no
0 858
no
0 872
no
1 872
no
1 0
yes
1 425
no
1 411
no
0 993
yes

output:

wait 2002
wait 2002
switch
wait 872
left
wait 2002
wait 1405
right

result:

ok OK

Test #229:

score: 0
Accepted
time: 10ms
memory: 3664kb

input:

1 1
no
0 955
no
0 941
no
0 0
yes
0 4
no
1 9
no
1 993
yes

output:

wait 1031
wait 2002
wait 941
left
wait 2002
wait 984
right

result:

ok OK

Test #230:

score: 0
Accepted
time: 7ms
memory: 3656kb

input:

0 353
no
0 364
no
0 376
no
1 376
no
1 0
yes
1 785
no
1 773
no
0 994
yes

output:

wait 2001
wait 2002
switch
wait 376
left
wait 2002
wait 1768
right

result:

ok OK

Test #231:

score: 0
Accepted
time: 14ms
memory: 3824kb

input:

1 4
no
0 496
no
0 484
no
0 0
yes
1 0
no
1 12
no
1 994
yes

output:

wait 1489
wait 2002
wait 484
left
wait 2002
wait 982
right

result:

ok OK

Test #232:

score: 0
Accepted
time: 5ms
memory: 3588kb

input:

1 598
no
1 588
no
1 578
no
1 0
yes
0 279
no
0 289
no
0 995
yes

output:

wait 2002
wait 2002
wait 578
left
wait 2002
wait 706
right

result:

ok OK

Test #233:

score: 0
Accepted
time: 14ms
memory: 3796kb

input:

0 0
no
1 604
no
1 594
no
1 0
yes
0 3
no
0 13
no
0 995
yes

output:

wait 1387
wait 2002
wait 594
left
wait 2002
wait 982
right

result:

ok OK

Test #234:

score: 0
Accepted
time: 14ms
memory: 3600kb

input:

0 40
no
1 776
no
1 768
no
1 0
yes
0 813
no
0 821
no
0 996
yes

output:

wait 1177
wait 2002
wait 768
left
wait 2002
wait 175
right

result:

ok OK

Test #235:

score: 0
Accepted
time: 13ms
memory: 3660kb

input:

0 0
no
0 607
no
0 599
no
0 0
yes
0 0
no
1 7
no
1 996
yes

output:

wait 1387
wait 2002
wait 599
left
wait 2002
wait 989
right

result:

ok OK

Test #236:

score: 0
Accepted
time: 10ms
memory: 3660kb

input:

0 183
no
1 305
no
1 499
no
1 0
yes
0 495
no
0 501
no
0 997
yes

output:

wait 1507
wait 1802
wait 499
left
wait 2002
wait 496
right

result:

ok OK

Test #237:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

0 2
no
1 506
no
1 500
no
1 0
yes
1 3
no
0 2
no
0 997
yes

output:

wait 1487
wait 2002
wait 500
left
wait 2002
wait 995
right

result:

ok OK

Test #238:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

1 938
no
1 934
no
1 930
no
1 0
yes
1 50
no
1 46
no
0 998
yes

output:

wait 2002
wait 2002
wait 930
left
wait 2002
wait 1045
right

result:

ok OK

Test #239:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

1 2
no
1 513
no
1 509
no
1 0
yes
0 3
no
0 7
no
0 998
yes

output:

wait 1487
wait 2002
wait 509
left
wait 2002
wait 991
right

result:

ok OK

Test #240:

score: 0
Accepted
time: 5ms
memory: 3648kb

input:

1 592
no
1 594
no
1 596
no
0 596
no
0 0
yes
0 811
no
0 809
no
1 999
yes

output:

wait 2002
wait 2002
switch
wait 596
left
wait 2002
wait 1809
right

result:

ok OK

Test #241:

score: 0
Accepted
time: 14ms
memory: 3660kb

input:

1 2
no
0 510
no
0 508
no
0 0
yes
1 4
no
1 6
no
1 999
yes

output:

wait 1487
wait 2002
wait 508
left
wait 2002
wait 993
right

result:

ok OK