QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#690869#9518. 观虫我 (旧版数据)hos_lyric#40 3990ms24728kbC++142.6kb2024-10-31 06:45:252024-10-31 06:45:25

Judging History

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

  • [2024-10-31 06:45:25]
  • 评测
  • 测评结果:40
  • 用时:3990ms
  • 内存:24728kb
  • [2024-10-31 06:45:25]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


constexpr int BLOCK = 5000;

int N, Q;
vector<char> O;
vector<unsigned> I;

vector<unsigned long long> as, bs;

void build(int e, int p0) {
  if (e == 0) {
    auto &b = bs[p0];
    b ^= (b & 0x00000000ffffffffULL) << 32;
    b ^= (b & 0x0000ffff0000ffffULL) << 16;
    b ^= (b & 0x00ff00ff00ff00ffULL) << 8;
    b ^= (b & 0x0f0f0f0f0f0f0f0fULL) << 4;
    b ^= (b & 0x3333333333333333ULL) << 2;
    b ^= (b & 0x5555555555555555ULL) << 1;
  } else {
    --e;
    const int p1 = p0 | 1 << e;
    for (int p = p0; p < p1; ++p) bs[p | 1 << e] ^= bs[p];
    build(e, p0);
    build(e, p0 | 1 << e);
  }
}

int main() {
  for (; ~scanf("%d%d", &N, &Q); ) {
    O.resize(Q);
    I.resize(Q);
    for (int q = 0; q < Q; ++q) {
      scanf(" %c%u", &O[q], &I[q]);
    }
    
    as.assign(1 << (N-6), 0ULL);
    bs.assign(1 << (N-6), 0ULL);
    
    for (int qL = 0, qR; qL < Q; qL = qR) {
      qR = min(qL + BLOCK, Q);
      copy(as.begin(), as.end(), bs.begin());
      build(N-6, 0);
      for (int q = qL; q < qR; ++q) {
        if (O[q] == '!') {
          as[I[q] >> 6] ^= 1ULL << (I[q] & 63);
        } else {
          int ans = bs[I[q] >> 6] >> (I[q] & 63) & 1;
          for (int qq = qL; qq < q; ++qq) if (O[qq] == '!') {
            if (!(I[qq] & ~I[q])) {
              ans ^= 1;
            }
          }
          printf("%d\n", ans);
        }
      }
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 2210ms
memory: 12024kb

input:

24 1000000
! 9475137
! 4501536
? 14277831
? 16695039
? 5723102
? 6093887
? 3014539
! 475969
? 12500973
! 8750136
? 15617895
! 4589313
! 152300
? 3612579
? 15248179
! 764162
! 4461105
? 7274495
? 13299697
! 8388872
? 13490383
! 3875594
! 9439685
? 16776189
! 6443172
? 13864879
! 395691
? 7142271
? 16...

output:

1
0
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
1
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
1
0
1
1
0
0
0
0
0
0
0
0
1
1
0
0
1
0
1
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
1
1
0
0
1
1
0
1
0
0
0
0
0
0
1
1
1
1
1
0
1
0
0
0
0
0
1
1
0
1
1
0
1
0
1
1
1
1
1
0
0
1
1
1
1
1
1
0
1
0
0
0
0
0
1
1
1
0
0
0
1
1
0
...

result:

ok Accepted.

Test #2:

score: 20
Accepted
time: 2230ms
memory: 12428kb

input:

24 1000000
! 0
? 16777215
! 0
! 0
! 262144
? 16777215
? 16777215
? 15728639
! 0
? 16777215
? 16777215
! 16384
? 16777211
! 0
? 16777215
! 0
! 0
? 16760831
! 0
! 0
? 16777215
! 0
? 16777215
! 0
? 16777215
! 0
? 16777215
? 16777215
! 0
! 0
? 16777215
? 16777215
? 16777215
? 16777215
! 32768
? 16777215...

output:

1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
1
0
0
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
0
1
0
1
1
1
0
0
1
0
1
0
0
0
0
0
1
0
0
1
0
1
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
0
1
0
1
0
0
1
1
1
1
0
0
0
0
1
1
1
1
1
0
1
1
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
...

result:

ok Accepted.

Test #3:

score: 20
Accepted
time: 2223ms
memory: 12440kb

input:

24 1000000
! 197632
! 1075232
? 16775167
! 65792
? 16777147
? 8388575
? 16252927
? 15825369
? 16775135
! 4194304
! 552
? 16775871
? 8125439
? 16252667
? 16768703
? 7864319
? 16773113
! 4722688
! 1048760
! 1028
? 16576484
! 2136320
? 16776703
? 16707039
? 12580831
! 100
? 16776191
! 17476
? 16773119
...

output:

1
1
0
1
1
0
1
0
0
1
1
1
1
0
0
1
0
1
1
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
1
1
0
1
0
1
1
0
0
1
0
0
0
1
0
0
1
0
1
0
1
1
1
1
0
0
1
1
0
1
1
0
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
0
0
1
0
0
1
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
1
1
0
1
0
0
...

result:

ok Accepted.

Test #4:

score: 20
Accepted
time: 2221ms
memory: 12392kb

input:

24 1000000
! 6820106
! 443659
! 3080
? 525571
! 377345
? 5504934
! 13641450
? 12039421
! 12866772
? 14514068
! 6489651
? 2882394
? 15728506
? 1559551
! 11885066
! 15575062
! 13885663
! 4246041
? 12441078
? 16742263
! 8407354
? 16773116
! 739912
? 14397343
? 8220285
? 15727728
? 3146756
? 14536632
? ...

output:

0
0
0
0
0
0
1
0
1
1
1
1
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
1
0
0
0
0
1
0
1
1
1
1
0
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
0
0
0
1
0
0
1
1
0
1
1
1
0
0
1
1
0
0
0
0
1
0
0
0
1
0
0
1
1
0
1
1
1
1
1
0
1
1
0
1
1
0
0
1
0
1
1
0
1
1
1
0
0
1
0
1
0
0
1
0
1
1
1
0
0
0
0
0
1
1
1
1
1
1
1
0
0
...

result:

ok Accepted.

Test #5:

score: 20
Accepted
time: 2230ms
memory: 12404kb

input:

24 1000000
! 131592
? 15728123
! 544
? 11780584
? 10477567
! 256
! 1032
? 15728638
? 16777207
? 15717887
! 8358425
! 0
! 237735
? 12582399
? 15777814
! 2240422
? 3878186
? 16777215
! 48
! 10322848
! 7758449
! 4994634
? 6696114
? 16760828
! 6295624
! 5329776
! 69648
! 0
! 6276117
! 9364500
! 11781556...

output:

0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
0
0
0
0
0
1
1
0
0
1
1
0
1
1
1
1
0
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
1
0
1
1
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
0
1
0
0
1
1
0
0
0
0
0
1
0
1
0
1
1
1
1
0
0
0
1
0
1
0
1
0
1
1
0
1
...

result:

ok Accepted.

Test #6:

score: 20
Accepted
time: 2229ms
memory: 11952kb

input:

24 1000000
! 10467318
! 16738876
! 2
! 0
! 16384
! 4194562
! 8204
? 18603
? 12862536
! 49
! 132168
! 6213595
! 16220133
? 12582863
? 680960
! 9441304
! 64
! 4195328
! 4194304
? 12617956
! 5369125
? 16072703
? 4915492
? 10729472
? 11067810
! 32
? 16777085
? 16711677
? 16774655
! 16334796
? 3121151
! ...

output:

1
0
1
0
1
1
0
1
1
0
0
0
0
1
1
0
0
0
1
0
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
1
0
1
0
0
0
1
0
1
0
1
1
1
0
0
0
1
1
1
0
0
1
1
0
0
1
0
0
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
1
0
0
0
1
0
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
0
0
0
0
1
1
1
1
1
1
1
1
0
...

result:

ok Accepted.

Test #7:

score: 20
Accepted
time: 2223ms
memory: 12396kb

input:

24 1000000
! 16773119
! 16515007
? 32
? 14647295
! 65536
! 16773117
? 12582895
! 12582879
? 16744447
? 9907711
! 8405120
? 16244446
! 256
! 393217
? 16711167
! 66048
? 16302047
! 1179648
! 199680
? 16777211
? 16773117
? 8126463
? 16777215
! 512
? 16777135
? 0
! 8192
! 8257535
? 1
! 4
! 16744187
? 21...

output:

0
0
1
1
1
0
1
1
1
0
1
1
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
1
1
0
1
1
1
1
1
0
0
1
1
1
0
0
0
1
1
1
1
0
1
1
0
0
0
1
0
1
0
1
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
1
1
1
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
1
1
1
1
0
1
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
0
1
0
1
0
0
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
1
1
0
...

result:

ok Accepted.

Test #8:

score: 20
Accepted
time: 2221ms
memory: 12460kb

input:

24 1000000
! 16764936
? 16776419
? 16775574
! 3182592
? 16773120
? 16775168
? 16775459
! 5369856
! 2310660
! 10965249
? 16758952
? 16776921
? 16642080
! 16773128
! 835717
? 16766163
? 16234302
! 11759872
? 5108382
? 16773120
! 16773120
? 16776864
! 8450048
! 6909952
! 16773120
! 15298560
! 16758762
...

output:

0
0
1
1
1
1
1
0
1
1
0
0
1
1
1
0
0
0
1
0
0
1
0
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
0
1
0
0
1
1
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
1
1
0
1
0
1
1
0
0
0
0
1
0
0
0
1
0
1
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
1
0
1
0
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
0
0
0
1
1
1
0
0
1
1
1
1
1
1
...

result:

ok Accepted.

Test #9:

score: 20
Accepted
time: 2234ms
memory: 12448kb

input:

24 1000000
! 2084864
? 16743423
! 2375680
? 8323006
? 16777199
! 1052676
! 8192
! 9675264
! 13045904
? 16776639
? 16710836
? 0
? 16251250
? 16768646
! 14974976
? 16776000
? 16775832
? 15728320
? 16217979
! 2101248
? 16777215
! 4128768
! 2080768
! 14213120
! 16285824
? 16668655
? 16776188
! 6037508
?...

output:

0
1
0
1
1
0
0
1
1
0
1
0
0
1
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
1
1
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
1
0
0
0
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
1
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
1
0
0
1
1
0
1
0
0
...

result:

ok Accepted.

Test #10:

score: 20
Accepted
time: 2217ms
memory: 12420kb

input:

24 1000000
! 1204808
! 5230471
? 295200
! 16709503
? 427666
? 0
! 1376552
! 4728839
! 262272
? 13408158
? 14352383
! 11955895
! 16515067
? 16777215
! 65569
! 5855981
? 11352945
! 16314879
? 1909256
! 16375558
! 3185312
? 11836419
! 9433711
? 2036849
! 4202562
! 8192
! 16777215
? 2056884
? 8421401
! ...

output:

0
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
0
0
0
0
0
1
0
1
0
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
0
1
0
0
0
1
0
1
1
0
1
0
0
1
1
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
0
...

result:

ok Accepted.

Subtask #2:

score: 20
Accepted

Test #11:

score: 20
Accepted
time: 3976ms
memory: 24576kb

input:

26 1000000
! 18006034
? 66957270
! 2133064
! 147618
! 34621442
? 49715575
? 62879287
! 18620682
? 67073751
! 62941186
! 7634532
? 67100031
? 12517237
! 4804997
? 65991126
! 138275
? 65722687
? 66043391
! 19147234
? 45743743
! 2242648
! 44378336
? 48226020
! 34341926
! 665045
? 55433083
! 5554254
? 4...

output:

0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
1
0
0
1
1
0
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
1
0
1
0
1
1
0
0
0
0
1
1
0
0
1
0
1
0
0
1
0
1
1
0
1
1
0
0
1
0
1
0
1
0
1
1
1
1
0
0
1
0
0
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
0
0
1
0
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
1
0
1
1
1
0
1
...

result:

ok Accepted.

Test #12:

score: 20
Accepted
time: 3990ms
memory: 24668kb

input:

26 1000000
! 0
! 16779264
! 4
? 67092479
? 67108863
! 1048832
! 0
? 67108863
? 67108863
? 67108863
? 67108863
! 0
! 0
! 0
? 67108863
! 2048
? 67108863
! 0
? 66584575
! 8192
! 0
? 67108863
? 67108863
! 0
! 0
? 67092479
? 67108863
! 0
? 67108863
? 67108863
? 67108863
? 67108863
? 67108863
! 0
? 671088...

output:

1
1
1
1
1
1
0
1
0
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
1
0
0
1
0
1
1
1
1
1
0
0
1
1
0
1
1
1
0
0
1
0
0
0
1
1
1
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
1
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
0
0
0
0
0
0
1
0
1
1
1
1
0
0
1
1
0
1
1
0
1
0
0
0
1
0
1
0
1
1
...

result:

ok Accepted.

Test #13:

score: 20
Accepted
time: 3983ms
memory: 24656kb

input:

26 1000000
! 34816
! 229376
? 33554422
? 62504959
! 271362
? 66965439
! 16777346
? 66977630
? 67108831
! 8194
? 58653671
! 8224
? 67108735
! 16793616
? 58589055
! 18874880
! 34816
? 58720191
! 526432
! 8397312
? 66977663
! 2097704
! 9437312
? 66060223
? 50331647
? 67108863
? 67104767
! 64
! 106497
?...

output:

0
1
1
0
0
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
0
1
0
0
0
0
1
0
0
0
1
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
1
0
1
1
1
0
1
1
0
1
1
1
0
0
0
1
0
0
1
1
0
1
1
0
0
1
0
1
0
0
1
0
0
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1
1
1
1
0
1
0
0
...

result:

ok Accepted.

Test #14:

score: 20
Accepted
time: 3957ms
memory: 24524kb

input:

26 1000000
! 12239560
? 11240340
? 56270731
! 15892480
? 66054107
? 58653679
? 67097875
? 29022650
! 44635136
! 9765921
? 46792429
? 41933503
! 311312
! 38289409
! 8912897
? 43515829
? 52935717
! 10028228
? 17263997
! 36244352
! 37748760
! 4816901
! 40788992
! 1180229
! 38429834
? 29015917
! 3296346...

output:

0
0
0
0
1
0
0
0
0
0
0
0
1
1
1
0
0
0
0
1
1
1
0
0
0
0
1
1
0
0
0
0
1
1
0
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
0
1
1
0
1
1
0
1
1
1
1
1
1
1
1
0
1
0
1
1
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
1
1
...

result:

ok Accepted.

Test #15:

score: 20
Accepted
time: 3955ms
memory: 24636kb

input:

26 1000000
! 17894450
! 28643972
! 33554432
! 528
? 14168274
! 2537556
! 44889809
? 31675344
? 8351743
! 43354354
! 65537
! 39790768
? 66579959
? 65994748
? 21499891
? 34735264
? 58720255
! 20972688
? 46437446
? 62910207
! 4210689
? 66060243
? 1181484
! 16851026
! 50331648
! 50374762
? 52527805
? 17...

output:

0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
1
1
1
0
1
0
0
0
0
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
1
0
1
1
0
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
0
1
0
1
1
0
0
0
0
0
1
1
1
0
1
1
1
0
1
0
1
1
0
0
0
1
0
0
0
1
0
1
0
1
1
1
1
0
1
1
1
1
1
0
0
1
0
0
1
1
0
1
...

result:

ok Accepted.

Test #16:

score: 20
Accepted
time: 3960ms
memory: 24572kb

input:

26 1000000
! 64945459
! 2130432
! 2532046
! 12599424
! 56282647
? 19344017
? 45090833
? 4805144
? 46960018
? 16943286
! 12584068
! 50327645
! 64749309
! 67005375
? 66944887
? 31721023
? 66584446
! 2048
! 50257395
? 45236384
! 7858013
? 1079434
! 2
! 10518528
? 67108863
! 34615298
! 33824768
? 628490...

output:

0
0
0
0
0
0
0
1
0
1
0
1
1
0
0
1
0
1
0
1
1
0
0
0
0
1
1
1
0
0
0
1
1
1
0
1
1
1
0
0
1
0
1
1
1
1
0
1
1
1
1
0
0
0
0
1
1
1
0
0
0
1
0
0
0
0
1
1
1
0
0
0
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
1
0
1
1
0
1
0
1
0
1
0
1
0
0
1
1
0
0
1
1
1
0
0
1
1
0
0
0
0
1
1
0
1
1
1
1
0
1
0
0
0
1
0
0
0
0
0
1
1
1
1
0
1
0
1
1
1
1
1
1
1
0
1
...

result:

ok Accepted.

Test #17:

score: 20
Accepted
time: 3949ms
memory: 24728kb

input:

26 1000000
! 50265974
? 67103483
? 33550318
! 67107839
! 2053
! 66772981
! 2150528
? 62906358
! 67027965
? 65544
? 67108863
! 50265903
? 16781313
? 67108863
? 66048
? 66567159
? 25243672
? 67108859
! 60129279
? 65007615
! 50331262
? 4718592
! 49283071
! 0
? 2261536
? 256
? 62914047
! 6815872
! 8262
...

output:

0
0
1
0
0
0
1
0
1
0
1
1
0
1
1
1
1
1
1
0
1
1
0
0
1
1
0
1
0
1
0
1
1
1
0
0
1
1
1
0
1
1
1
1
1
1
0
0
0
0
1
0
1
1
1
1
0
1
1
1
0
1
1
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
0
0
0
1
1
0
1
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
1
1
0
0
1
0
1
1
1
1
0
0
0
1
0
1
0
0
1
1
1
1
0
0
0
1
0
1
0
0
1
0
0
0
0
1
0
1
1
0
1
1
1
0
1
0
1
1
0
0
...

result:

ok Accepted.

Test #18:

score: 20
Accepted
time: 3964ms
memory: 24588kb

input:

26 1000000
! 66052096
? 42209280
? 67104857
! 67100800
! 67100672
? 67093698
? 67102967
! 67100736
! 65003520
! 57491456
? 66969856
? 67105249
? 67101966
? 67103853
! 65626112
? 27226114
? 67100674
? 66969600
! 67100688
! 67100672
! 20259584
? 67100680
! 58220584
? 67105285
! 33548292
! 36084616
! 5...

output:

0
1
0
1
1
0
0
1
0
1
0
0
0
1
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
1
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
1
1
0
1
0
0
0
1
1
1
0
0
0
1
0
1
0
0
1
0
0
1
0
0
1
1
0
0
0
0
1
1
1
1
0
1
1
0
0
0
0
0
0
1
1
0
1
1
1
1
1
1
0
0
0
1
0
0
1
0
1
0
1
0
0
0
0
1
1
1
0
1
...

result:

ok Accepted.

Test #19:

score: 20
Accepted
time: 3964ms
memory: 24584kb

input:

26 1000000
! 13918736
? 49807334
? 65011455
? 67102822
? 67108726
! 57503776
? 67105367
! 17432832
? 67074047
? 67107284
? 67090997
! 491520
! 10436672
? 66971808
? 67107137
! 5545984
? 67100784
? 67102789
! 21217280
! 20914176
? 67104416
! 30859264
! 20201472
! 27369480
? 67106623
? 67107466
? 6710...

output:

0
1
0
1
1
1
1
0
0
1
1
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
0
1
1
1
0
1
0
0
1
0
1
1
1
0
1
0
1
1
0
1
0
0
0
0
0
1
0
1
0
0
1
1
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
1
1
1
0
0
1
0
1
0
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
0
0
0
1
1
0
0
1
1
0
1
1
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
1
...

result:

ok Accepted.

Test #20:

score: 20
Accepted
time: 3976ms
memory: 24640kb

input:

26 1000000
! 59739044
? 37748736
? 28249674
? 34779261
! 1408249
? 66289518
? 67108863
! 2772107
? 58719741
! 10498082
? 66052095
! 688328
! 49649064
? 49739239
! 12582912
! 33478607
? 0
! 26083666
! 20736
? 56016858
! 1097
! 47696511
? 40296265
? 48219897
! 62242430
! 58515375
? 17563672
! 62806902...

output:

0
0
0
0
0
1
0
1
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
1
1
0
1
1
1
1
1
1
1
0
1
0
0
0
1
0
0
0
1
1
0
0
1
0
0
1
1
1
0
1
0
0
0
0
0
0
0
1
0
0
0
0
1
1
0
1
1
0
1
0
1
0
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
1
1
1
1
0
1
0
0
1
1
0
0
1
1
1
1
1
1
1
1
1
0
0
0
1
0
0
0
0
1
1
0
1
1
1
1
...

result:

ok Accepted.

Subtask #3:

score: 0
Time Limit Exceeded

Test #21:

score: 0
Time Limit Exceeded

input:

28 1000000
! 1081468
! 128476263
! 67930241
? 94304031
! 103698752
! 19982
! 198050624
? 249519591
? 71286719
? 255700799
! 103309888
! 819340
! 12852092
? 124739445
? 192734967
! 101320328
! 117594711
? 252032927
! 134267948
? 262940285
! 3155972
? 267876218
! 41984160
? 246413294
? 246824252
? 163...

output:

0
0
1
0
1
0
0
0
0
0
1
1
1
0
0
0
1
0
1
1
1
0
0
0
1
1
0
1
1
1
0
0
1
0
1
1
1
0
0
0
1
0
1
1
1
0
0
1
1
0
0
1
0
0
1
1
1
0
1
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
1
0
1
1
1
0
0
0
0
0
0
1
0
1
0
1
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
1
0
0
0
1
0
1
1
1
0
0
0
1
0
1
1
1
0
1
1
0
1
0
1
...

result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #31:

score: 0
Time Limit Exceeded

input:

30 1000000
! 33852274
? 1017904007
? 1046413001
! 151029382
? 466826079
? 250568375
! 6769874
! 2106474
? 536832803
? 209627867
! 167104971
? 1048372157
! 245380745
! 25174496
? 819646460
! 539548800
! 671358165
? 402955591
? 527753201
! 582494209
? 862862931
? 938974695
? 263672827
? 366968669
? 87...

output:

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

result:


Subtask #5:

score: 0
Time Limit Exceeded

Test #41:

score: 0
Time Limit Exceeded

input:

32 1000000
! 2474971548
! 348268033
? 1055293046
? 3382525679
? 1805515707
? 3210332902
? 2805668987
? 4025974780
! 2217771280
! 176949664
! 4213841344
! 1477473321
? 3150869759
? 2127418041
! 1610631720
! 3624477314
! 2288149532
! 70909964
! 40117153
! 1343751456
? 3758095615
! 513059275
! 31956816...

output:

0
0
0
0
0
0
0
0
1
1
1
0
1
1
0
1
0
0
1
1
0
0
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
1
0
1
0
0
0
1
1
0
1
0
1
0
0
1
1
1
0
1
1
0
1
0
0
0
0
1
0
1
1
1
0
0
0
0
0
1
0
0
0
1
0
1
1
0
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
0
0
0
1
0
1
1
1
0
0
1
1
0
1
0
0
1
1
1
0
0
1
1
1
1
1
1
1
...

result: