QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#89386#4063. 倍增james1BadCreeper8 669ms13652kbC++142.9kb2023-03-19 22:00:342023-03-19 22:00:36

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-19 22:00:36]
  • 评测
  • 测评结果:8
  • 用时:669ms
  • 内存:13652kb
  • [2023-03-19 22:00:34]
  • 提交

answer

#include <bits/stdc++.h>
#define Getchar() p1 == p2 and (p2 = (p1 = Inf) + fread(Inf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++
#define Putchar(c) p3 == p4 and (fwrite(Ouf, 1, 1 << 21, stdout), p3 = Ouf), *p3++ = c
char Inf[1 << 21], Ouf[1 << 21], *p1, *p2, *p3 = Ouf, *p4 = Ouf + (1 << 21);
inline int read (void)
{
    int x = 0; char c = Getchar();
    while (c < '0' or c > '9') c = Getchar();
    while (c >= '0' and c <= '9') x = x * 10 + c - 48, c = Getchar();
    return x;
}
inline void write (int x)
{
    if (x >= 10) write(x / 10), x %= 10;
    Putchar(x ^ 48);
}
const int maxn = 200000 + 10;
int ans[maxn]; std::vector<int> ans0[maxn], ans1[maxn];
inline void solve (int B)
{
    int p[20], w[20]; bool vis[20];
    for (int n = 3; ; n++)
    {
        for (int i = 1; i <= n; i++) p[i] = i;
        while (std::next_permutation(p + 1, p + n + 1))
            for (int S = 2; S < (1 << n - 1); S += 2)
            {
                for (int i = 1; i <= n; i++) w[i] = -1, vis[i] = false;
                for (int i = 1; i <= n; i++) if (!vis[i])
                {
                    int a[20] = {0}, wx[20] = {0}, wy[20] = {0}, m = 0;
                    for (int j = i; !vis[j]; j = p[j]) vis[a[++m] = j] = true;
                    wx[1] = 1; wy[1] = 0;
                    for (int j = 2; j <= m; j++)
                    {
                        wx[j] = 2 * wx[j - 1];
                        wy[j] = 2 * wy[j - 1] + ((S >> (a[j - 1] - 1)) & 1) - B * ((S >> a[j - 1]) & 1);
                    }
                    wx[1] = 2 * wx[m] - 1;
                    wy[1] = 2 * wy[m] + ((S >> (a[m] - 1)) & 1) - B * ((S >> a[m]) & 1);
                    if (wy[1] % wx[1] != 0) continue;
                    w[a[1]] = - wy[1] / wx[1];
                    for (int j = 2; j <= m; j++) w[a[j]] = wx[j] * w[a[1]] + wy[j];
                }
                bool flag = true;
                for (int i = 1; i <= n; i++) flag &= 0 <= w[i] and w[i] < B;
                if (flag)
                {
                    ans[B] = n;
                    for (int i = 1; i <= n; i++) if ((S >> i) & 1)
                    {
                        for (int j = n; j > i; j--) ans0[B].push_back(w[j]);
                        for (int j = i; j > 0; j--) ans1[B].push_back(w[j]);
                        return;
                    }
                }
            }
    }
}
signed main () {
    for (int T = read(); T--; ) {
        int n = read(), B = read();
        if (!ans[B]) solve(B);
        if (ans[B] > n) {Putchar('-'); Putchar('1'); Putchar('\n'); continue;}
        std::vector<int> Ans;
        for (int x: ans0[B]) Ans.push_back(x);
        for (int i = 0; i < n - ans[B]; i++) Ans.push_back(B - 1);
        for (int x: ans1[B]) Ans.push_back(x);
        for (int i = 0; i < n; i++) write(Ans[i]), Putchar(" \n"[i == n - 1]);
    }
    fwrite(Ouf, 1, p3 - Ouf, stdout); fflush(stdout);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10
4 4
8 3
8 3
1 4
2 2
6 5
2 3
8 8
3 2
7 2

output:

1 0 3 2
1 0 1 2 2 2 2 2
1 0 1 2 2 2 2 2
-1
-1
0 1 4 4 4 3
-1
0 2 7 7 7 7 7 5
0 0 1
0 0 1 1 1 1 1

result:

wrong answer Jury found an answer but participant doesn't

Test #2:

score: 0
Wrong Answer
time: 4ms
memory: 12956kb

input:

10000
6 2
6 4
6 2
6 3
3 3
1 4
2 3
2 2
5 4
5 4
6 2
5 3
7 2
3 3
3 6
3 2
7 3
5 3
4 2
8 3
4 2
3 3
2 3
2 2
4 2
7 3
8 2
6 2
3 2
8 3
5 2
5 4
8 2
8 3
2 3
8 2
1 2
2 2
1 2
2 3
3 3
7 3
3 4
1 2
5 3
3 2
2 2
6 3
1 2
6 4
3 5
7 3
7 2
5 2
6 5
7 3
4 2
8 3
4 2
7 2
5 2
2 2
8 3
7 3
1 2
6 3
8 2
6 2
7 3
4 3
8 2
7 2
6 2
1 ...

output:

0 0 1 1 1 1
1 0 3 3 3 2
0 0 1 1 1 1
1 0 1 2 2 2
-1
-1
-1
-1
1 0 3 3 2
1 0 3 3 2
0 0 1 1 1 1
1 0 1 2 2
0 0 1 1 1 1 1
-1
-1
0 0 1
1 0 1 2 2 2 2
1 0 1 2 2
0 0 1 1
1 0 1 2 2 2 2 2
0 0 1 1
-1
-1
-1
0 0 1 1
1 0 1 2 2 2 2
0 0 1 1 1 1 1 1
0 0 1 1 1 1
0 0 1
1 0 1 2 2 2 2 2
0 0 1 1 1
1 0 3 3 2
0 0 1 1 1 1 1 1...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #3:

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

input:

10
2 3
4 2
2 4
192276 5
11 3
6 7
7492 2
8 2
197 8
2 3

output:

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

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #4:

score: 0
Wrong Answer
time: 7ms
memory: 13304kb

input:

10000
7 2
84 2
8 3
1 2
7 2
2 3
10 2
4 3
6 2
8 3
1 2
2 2
37 2
380 2
7 2
3 2
7 2
8 2
8 3
6 2
5 2
6 3
5 2
29 2
2 3
2 2
5 2
7 3
4 2
3 2
4 2
1 2
6 2
8 2
5 4
1 2
5 4
8 2
1 2
6 2
8 3
6 2
6 3
4 2
32 2
6 3
1 2
3 2
7 4
4 2
3 5
7 2
434 4
5 2
1 2
8 2
24 2
5 2
5 2
6 2
4 2
1 6
2 3
7 2
5 4
10 2
10 5
8 2
4 3
8 2
3 ...

output:

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

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #5:

score: 0
Wrong Answer
time: 3ms
memory: 13204kb

input:

10000
3 3
1 2
48 2
3 2
7 3
2 2
61 2
6 3
6 2
7 3
3 3
3 2
4 2
4 2
6 2
1 3
6 2
4 2
127 2
51 3
5 6
6 2
51 6
7 2
6 2
4 3
7 2
2 6
3 2
3 2
3 2
8 2
6 3
7 4
3 4
4 2
8 2
5 3
8 3
6 2
6 2
2 4
5 2
4 2
3 3
5 3
2 2
8 2
2 3
5 3
12 2
7 3
5 2
6 4
4 3
2 2
3 3
4 2
5 3
3 3
5 2
8 2
5 2
2 2
7 2
5 2
7 2
8 2
2 2
1 3
7 2
5 2...

output:

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

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #6:

score: 0
Wrong Answer
time: 4ms
memory: 12852kb

input:

100
1 10
2 11
8 3
8 3
2 3
8 3
1 5
5 7
2 4
6 5
7 10
10 7
8 3
8 10
7 4
6 5
10 4
2 5
4 2
5 3
2 3
4 6
7 3
6 8
8 10
6 7
5 5
2 2
4 12
7 2
2 8
5 15
4 13
6 5
6 10
2 12
1 4
3 5
8 9
1 3
8 8
4 3
5 5
4 13
7 2
5 4
3 5
8 2
2 7
1 4
2 5
6 3
1 5
8 11
9 10
3 12
2 6
4 5
5 4
3 2
7 5
8 4
2 9
4 3
6 9
1 5
7 8
4 2
10 4
15 ...

output:

-1
-1
1 0 1 2 2 2 2 2
1 0 1 2 2 2 2 2
-1
1 0 1 2 2 2 2 2
-1
1 2 5 6 4
-1
0 1 4 4 4 3
1 2 5 8 9 7 4
1 2 5 6 6 6 6 6 6 4
1 0 1 2 2 2 2 2
1 2 5 8 9 9 7 4
1 0 3 3 3 3 2
0 1 4 4 4 3
1 0 3 3 3 3 3 3 3 2
-1
0 0 1 1
1 0 1 2 2
-1
2 1 3 4
1 0 1 2 2 2 2
0 2 7 7 7 5
1 2 5 8 9 9 7 4
1 2 5 6 6 4
0 1 4 4 3
-1
2 4 ...

result:

wrong answer Jury found an answer but participant doesn't

Test #7:

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

input:

100
4 10
3 18
4 31
7 10
3 4
4 13
1 14
3 33
6 8
3 34
2 16
5 8
9 26
5 18
7 16
15 12
8 16
3 10
8 18
40 6
4 2
1 12
1 28
5 17
8 20
4 2
7 30
1 16
2 30
6 31
4 32
8 21
8 28
2 12
8 3
15 23
8 11
37 3
4 12
2 13
2 17
2 15
3 34
16 24
3 10
4 17
1 5
2 17
7 12
7 12
4 17
7 15
8 15
5 24
2 40
3 6
6 2
27 4
8 32
1 36
1 ...

output:

-1
5 2 10
-1
1 2 5 8 9 7 4
1 0 2
5 2 7 10
-1
-1
0 2 7 7 7 5
-1
-1
0 2 7 7 5
0 8 25 25 25 25 25 25 17
5 2 17 17 10
2 4 15 15 15 15 9
2 4 9 11 11 11 11 11 11 11 11 11 11 11 7
2 4 15 15 15 15 15 9
-1
5 2 17 17 17 17 17 10
2 1 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4
0...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #8:

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

input:

100
2 93
6 69
14 82
49 80
1 50
9 64
7 31
5 31
2 13
6 100
4 93
4 19
6 18
2 37
2 76
1 60
8 33
5 68
3 6
2 93
57 41
2 79
6 78
47 34
9 61
7 66
3 13
3 12
5 15
7 57
8 66
6 45
5 59
4 23
1 98
6 90
1 8
30 33
8 49
2 82
38 86
6 49
29 12
6 10
7 90
7 63
5 2
8 57
4 64
5 72
8 76
6 15
4 78
28 63
60 30
37 87
6 14
7 4...

output:

-1
23 22 45 68 68 46
16 32 65 81 81 81 81 81 81 81 81 81 81 49
0 26 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 53
-1
4 8 63 63 63 63 63 34 17
4 8 17 26 30 22 13
-1
-1
14 28 99 99 99 57
13 26 92 53
1 2 10 5...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #9:

score: 0
Wrong Answer
time: 6ms
memory: 12784kb

input:

100
4 150
3 25
1 213
36 202
4 96
4 211
8 176
50 182
5 221
93 63
4 108
1 100
1 8
30 6
27 131
2 80
5 157
6 192
300 65
7 12
20 192
88 103
7 236
50 97
6 256
7 136
8 187
8 40
2 17
1 71
2 243
7 200
70 123
7 91
14 266
4 77
3 127
3 61
4 94
3 161
2 45
6 165
3 261
7 160
7 115
1 138
148 50
8 105
8 256
1 67
88 ...

output:

50 49 99 100
7 3 14
-1
40 80 161 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 201 121
32 31 63 64
-1
0 58 175 175 175 175 175 117
0 60 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 18...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #10:

score: 0
Wrong Answer
time: 11ms
memory: 12832kb

input:

100
11 840
2 9
5 501
3 691
5 287
29 599
7 407
88 97
5 775
5 307
3 499
1 610
8 432
8 820
64 85
7 39
6 691
6 544
2 387
4 626
6 611
7 158
8 236
69 502
7 432
6 160
2 516
8 866
8 242
3 558
6 433
6 177
6 88
679 460
4 253
7 505
4 565
9 931
8 366
6 331
7 640
4 778
60 4
4 667
1 913
5 376
29 88
3 59
8 441
3 7...

output:

280 279 559 839 839 839 839 839 839 839 560
-1
143 71 500 500 286
-1
0 95 286 286 191
0 199 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 598 399
0 135 406 406 406 406 271
19 38 77 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #11:

score: 0
Wrong Answer
time: 57ms
memory: 12816kb

input:

100
7 1391
7 2313
8 1127
3 674
1 845
5 2167
25 2265
70 92
8 2611
453 586
7 667
8 2280
7 1891
1 2897
60 26
4 2325
7 945
3000 608
7 1351
23 25
71 1435
5 2518
7 2669
6 91
6 243
5 2596
7 2114
4 1864
19 283
5 2958
31 50
7 1642
2052 17
6 505
108 2099
7 1379
17 1078
1400 1516
7 902
5 2629
7 1981
6 91
9 565...

output:

0 463 1390 1390 1390 1390 927
925 462 1387 2312 2312 2312 1850
0 375 1126 1126 1126 1126 1126 751
0 224 449
-1
619 309 2166 2166 1238
647 323 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 2264 1294
0 30 91 91 91 91 91 91 91 91 91 91 91 91 91...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #12:

score: 0
Wrong Answer
time: 50ms
memory: 13216kb

input:

100
8 9451
1 1885
3 433
6 763
2 53
3 1590
6 8566
4 1807
2 1514
7 10720
4 2103
622 155
98 22
4 1096
2 878
2129 562
2 582
5 37
4 2043
8 353
183 1550
6 2129
1 664
2 368
4598 514
51 2
8 8191
9 8335
51 99
5 974
1444 1405
6 513
5 777
3121 1395
8 139
6 1585
7 2113
8 10891
58 79
1 1748
5 114
4 675
4 1299
68...

output:

2679 1339 5358 669 9450 5060 2530 1265
-1
-1
305 152 457 762 762 610
-1
-1
2447 1223 4894 6118 7342 3671
361 722 1445 1084
-1
1531 3062 6125 9188 10719 7657 4594
841 420 1261 1682
0 51 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154 154...

result:

wrong answer Jury found an answer but participant doesn't

Test #13:

score: 0
Wrong Answer
time: 669ms
memory: 13340kb

input:

100
4 5
43 6
19 5
5 2
76 92
36 31
1 2
7 8
73 37
7 6541
9 196
5 3190
6 47755
3 4
8 5
8 7066
31 13
3 6
53 17
50000 6
6 6
10400 5
4591 2
3 3
6 2
6 11
2 2
6 2
1 4
36 74
7219 4
6 5
4 6
6 4
62 6
7 9
5 5
8 2
2 4
98 83
5 4
61 40
5 4
3 3
215 10
5 4
33830 10
12 2
8 11
8 9
10 12
1 6
6 2
6 3580
3 2
1943 6
8 283...

output:

0 1 4 3
2 1 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4
0 1 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3
0 0 1 1 1
0 30 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 ...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #14:

score: 0
Wrong Answer
time: 657ms
memory: 13488kb

input:

100
47 11
30210 3
7 2
8 72136
1 2
56 50
7 3
8 1270
4 4
5 4
72 90
1 9
7 7
5 7
7 5
29 3
6 7
5931 3
12 7
8 3
6 6
7 7
2 4
8 2
435 6
182 3
7 48385
7 5
80 3
8 4
1 3
9 160
7 346
8 17326
8952 4
2 3
1799 3
6 3
8 61
7 4
70 99
6 2
6 5
1091 2
8 3
3 5
1 9
8 3
8 7
2 2
4 4
14 94
13586 5
58 90
4 2
7 4
6 1216
8 3
38...

output:

0 3 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 7
1 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #15:

score: 0
Wrong Answer
time: 4ms
memory: 13364kb

input:

1500
101 13
103 130
109 39
102 108
104 52
105 165
100 28
105 103
100 42
108 37
100 144
105 160
105 13
105 113
111 25
107 61
101 126
103 97
111 20
105 146
140 14
107 35
103 123
103 12
105 142
108 92
100 64
106 74
107 78
106 165
108 13
108 42
102 19
104 66
101 33
103 22
100 17
100 84
101 104
104 98
10...

output:

5 2 7 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 10
...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #16:

score: 0
Wrong Answer
time: 51ms
memory: 13536kb

input:

1300
108 88
103 212
105 174
542 39
108 110
218 262
106 28
103 166
103 47
102 11
101 41
108 193
101 288
107 131
101 6
101 206
103 125
1434 115
104 118
146 29
105 165
107 28
106 32
102 79
102 186
107 225
106 36
105 39
102 56
210 20
102 7
101 26
105 159
104 93
108 260
107 204
101 168
103 38
103 137
151...

output:

25 12 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 ...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #17:

score: 0
Wrong Answer
time: 666ms
memory: 13272kb

input:

1000
106 3
101 391
102 2
101 3
108 2
106 3
100 2
108 2
102 3
107 3
845 2
108 2
103 2
106 2
231 2
103 4
102 2
105 2
108 2
103 2
106 2
131 2
102 2
108 2
107 2
100 2
100 2
108 2
104 2
108 2
112 2
100 2
100 2
242 4
1895 2
104 2
106 2
105 2
100 3
986 3
136 2
103 2
112 2
104 3
102 3
103 2
104 2
100 2
107 ...

output:

1 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
43 86 347 217 173 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 390 39...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #18:

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

input:

10000
4 5
7 2
4 83
3 68
2 8
1 47
15 5
2 2
5 2
2 2
6 68
1 5
6 56
3 2
2 17
1 80
6 5
7 17
8 8
6 41
8 89
9 14
7 32
5 17
2 2
76 23
8 2
7 20
6 5
2 38
3 5
8 53
3 5
1 86
2 23
4 2
3 2
6 2
2 44
2 53
245 77
4 32
4 8
2 2
6 5
7 2
1 2
7 8
1 2
5 2
1 29
1 2
7 2
6 62
3 20
3 35
130 2
5 8
7 14
6 17
4 2
6 14
3 2
6 14
8...

output:

0 1 4 3
0 0 1 1 1 1 1
0 27 82 55
0 22 45
-1
-1
0 1 4 4 4 4 4 4 4 4 4 4 4 4 3
-1
0 0 1 1 1
-1
0 22 67 67 67 45
-1
0 18 55 55 55 37
0 0 1
-1
-1
0 1 4 4 4 3
0 5 16 16 16 16 11
0 2 7 7 7 7 7 5
0 13 40 40 40 27
0 29 88 88 88 88 88 59
0 4 13 13 13 13 13 13 9
0 10 31 31 31 31 21
0 5 16 16 11
-1
0 7 22 22 2...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #19:

score: 0
Wrong Answer
time: 8ms
memory: 13304kb

input:

10000
4 2
6 2
7 35
8 53
7 14
1 20
8 2
2 2
47 59
8 5
4 77
6 2
5 26
3 26
1 2
4 2
7 41
8 74
3 2
3 2
5 5
5 14
7 32
3 5
3 2
6 2
4 32
5 44
4 14
8 32
6 8
6 2
7 2
15 2
1 8
3 2
7 2
2 11
8 44
1 5
1 56
4 23
1 14
4 5
1 5
1 2
1 8
8 50
90 2
1 8
2 2
154 2
6 2
4 2
1 44
4 56
177 2
6 17
1 2
7 5
1 11
8 56
7 2
6 2
6 17...

output:

0 0 1 1
0 0 1 1 1 1
0 11 34 34 34 34 23
0 17 52 52 52 52 52 35
0 4 13 13 13 13 9
-1
0 0 1 1 1 1 1 1
-1
0 19 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 39
0 1 4 4 4 4 4 3
0 25 76 51
0 0 1 1 1 1
0 8 25 25 17
0 8 1...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #20:

score: 4
Accepted
time: 6ms
memory: 13116kb

input:

10000
1 12
144 3
6 3
5 48
1 18
2 21
6 45
3 42
5 18
8 3
7 3
8 6
7 39
2 3
7 15
2 3
2 6
1 3
49 27
2 54
6 39
8 3
8 30
1 3
4 3
8 3
6 54
7 12
3 39
8 42
6 12
8 9
7 12
15 6
6 24
6 3
3 27
5 3
7 3
5 27
3 3
4 15
5 45
7 36
3 9
8 6
1 51
162 12
4 18
7 3
4 72
1 21
6 3
120 3
10 15
1 21
3 3
5 63
2 9
2 9
3 33
8 63
3 ...

output:

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

result:

ok Accepted

Test #21:

score: 4
Accepted
time: 3ms
memory: 13408kb

input:

10000
1 54
4 3
265 18
406 3
2 66
2 21
3 51
6 69
18 6
3 3
137 3
6 54
1 3
2 15
2 30
6 18
4 63
1 9
396 6
3 6
1 30
155 3
9 66
3 57
4 39
1 54
7 30
3 21
1 15
7 15
2 3
3 27
2 3
92 12
2 21
3 3
4 15
3 45
7 27
44 6
8 3
8 12
3 15
8 15
5 3
7 30
1 3
2 12
8 3
4 12
2 96
8 33
5 3
5 3
4 9
9 3
2 54
4 3
5 6
1 3
110 3
...

output:

-1
1 0 1 2
5 2 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 ...

result:

ok Accepted

Test #22:

score: 0
Wrong Answer
time: 6ms
memory: 13036kb

input:

10000
6 18
4 37
4 40
1 16
6 6
8 14
7 7
4 12
5 32
7 29
2 13
4 39
1 10
1 27
6 31
3 11
6 14
8 32
6 16
6 13
7 10
4 8
1 42
24 18
6 7
1 37
7 4
6 8
7 13
6 26
8 34
3 38
3 21
4 7
60 15
2 29
6 29
8 27
4 36
7 32
5 31
1 22
3 7
3 12
8 32
3 13
3 5
7 30
5 37
3 27
6 18
2 29
6 23
8 24
5 17
36 12
4 24
8 19
2 11
6 22
...

output:

5 2 17 17 17 10
5 10 36 21
-1
-1
2 1 3 5 5 4
0 4 13 13 13 13 13 9
1 2 5 6 6 6 4
2 4 9 7
0 10 31 31 21
0 9 28 28 28 28 19
-1
11 5 38 22
-1
-1
4 8 17 26 22 13
0 3 7
0 4 13 13 13 9
0 10 31 31 31 31 31 21
2 4 15 15 15 9
5 2 7 12 12 10
1 2 5 8 9 7 4
0 2 7 5
-1
5 2 17 17 17 17 17 17 17 17 17 17 17 17 17 1...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #23:

score: 0
Wrong Answer
time: 55ms
memory: 13412kb

input:

10000
8 4
5 4
1 3
7 23
6 32
1 25
8 23
1 7
5 29
6 23
8 18
1 28
8 30
3 20
6 39
8 36
1 16
393 3
5 3
3 28
8 19
6 5
6 7
8 5
5 6
2 35
1 24
5 19
7 4
1 9
4 13
3 22
4 16
6 21
1 15
7 9
8 29
8 10
17 14
2 27
8 13
2 18
5 17
8 23
44 32
7 11
18 13
3 7
1 20
6 37
3 2
2 3
3 2
304 17
132 5
14 20
5 10
2 40
5 2
2 18
6 7...

output:

1 0 3 3 3 3 3 2
1 0 3 3 2
-1
0 7 22 22 22 22 15
0 10 31 31 31 21
-1
0 7 22 22 22 22 22 15
-1
0 9 28 28 19
0 7 22 22 22 15
5 2 17 17 17 17 17 10
-1
4 8 29 29 29 29 29 17
0 6 13
11 5 38 38 38 22
12 11 23 35 35 35 35 24
-1
1 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #24:

score: 0
Wrong Answer
time: 669ms
memory: 13228kb

input:

10000
4 2
12 2
5 2
5 2
234 2
6 2
7 2
14 2
368 2
6 2
8 2
8 2
8 2
8 2
7 2
2 2
2 2
8 2
5 2
3 2
6 2
7 2
7 2
7 2
4 2
5 2
55 2
8 2
3 2
3 2
2 2
8 2
11 2
2 2
8 2
8 2
31 2
8 2
8 2
192 2
4 2
8 2
2 2
2 2
4 2
7 2
2 2
3 3
7 2
5 2
1 2
2 2
2 2
1 2
8 2
5 2
17 2
7 2
4 2
151 2
4 2
6 2
8 2
5 2
8 2
2 2
68 2
6 2
1 2
6 2...

output:

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

result:

wrong answer Your answer shouldn't have any bit both equal to 0

Test #25:

score: 0
Wrong Answer
time: 659ms
memory: 13244kb

input:

10000
7 2
2 2
6 2
3 2
6 2
3 2
7 2
6 2
6 2
2 2
1 2
4 2
3 2
57 2
7 2
8 2
44 2
3 2
6 2
3 2
332 2
3 2
8 2
7 2
4 2
8 2
4 2
2 2
6 2
36 2
5 2
2 2
8 2
2 2
8 2
3 2
4 2
7 2
3 2
6 2
8 2
7 2
8 2
18 2
8 2
8 2
4 2
2 2
7 2
8 2
2 3
8 2
3 2
5 2
4 3
4 2
6 2
1 2
3 2
4 2
2 2
5 2
3 2
135 2
3 2
4 2
6 2
3 2
361 2
7 2
5 2
...

output:

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

result:

wrong answer Your answer shouldn't have any bit both equal to 0