QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#399857#370. Citybashkort#100 ✓128ms8740kbC++204.3kb2024-04-26 18:36:032024-07-04 03:38:39

Judging History

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

  • [2024-07-04 03:38:39]
  • 评测
  • 测评结果:100
  • 用时:128ms
  • 内存:8740kb
  • [2024-04-26 18:36:03]
  • 提交

Encoder

#include "Encoder.h"
#include <bits/stdc++.h>

using namespace std;

void Encode(int n, int U[], int V[]) {
    vector<vector<int>> adj(n);
    for (int i = 0; i < n - 1; ++i) {
        adj[U[i]].push_back(V[i]);
        adj[V[i]].push_back(U[i]);
    }
    constexpr int B = 63;
    constexpr int A0 = 7, A1 = 14;
    vector<int> code(n), siz(n), type(n), father(n), tin(n), tout(n);
    vector<vector<int>> g(n);
    auto dfs = [&](auto self, int v) -> void {
        siz[v] = 1;
        vector<int> nxt;
        for (int to : adj[v]) {
            adj[to].erase(std::find(adj[to].begin(), adj[to].end(), v));
            self(self, to);
            siz[v] += siz[to];
        }
        type[v] = siz[v] >= B;
        for (int to : adj[v]) {
            if (siz[to] < B && type[v] == 1) {
                nxt.push_back(to);
            } else {
                g[v].push_back(to);
            }
        }
        if (type[v] == 0) {
            return;
        }
        vector<int> stk;
        int sum_stk = 0;
        for (int x : nxt) {
            stk.push_back(x);
            sum_stk += siz[x];
            if (sum_stk >= B) {
                int new_vertex = size(tin);
                g.push_back(stk);
                g[v].push_back(new_vertex);
                tin.push_back({}), tout.push_back({});
                type.push_back(1);
                stk.clear();
                sum_stk = 0;
            }
        }
        g[v].insert(g[v].end(), stk.begin(), stk.end());
        sum_stk = 0;
    };
    dfs(dfs, 0);

    int cnt[2]{};
    auto gfs = [&](auto self, int v, int last) -> void {
        tin[v] = cnt[type[v]];
        cnt[type[v]] += 1;
        if (type[v] == 1) {
            for (int to : g[v]) {
                if (type[to] == 1) {
                    self(self, to, v);
                }
            }
            cnt[0] = 0;
            for (int to : g[v]) {
                if (type[to] == 0) {
                    self(self, to, v);
                }
            }
        } else {
            father[v] = last;
            for (int to : g[v]) {
                self(self, to, last);
            }
        }
        tout[v] = cnt[type[v]];
    };
    gfs(gfs, 0, 0);
    int mx = 0;
    for (int i = 0; i < g.size(); ++i) {
        if (type[i] == 1) {
            mx = max(mx, tout[i]);
        }
    }
    if ((1 << A1) <= mx) {
        return;
    }
    assert((1 << A1) > mx);
    for (int v = 0; v < n; ++v) {
        if (type[v] == 1) {
            code[v] = ((((tout[v] - tin[v]) << A1) + tin[v]) << 1) + 1;
        } else {
            code[v] = (((((tin[father[v]] << A0) + tout[v] - tin[v]) << A0) + tin[v]) << 1) + 0;
        }
//        if (v == 3 || v == 21) {
//            cout << v << ":\n";
//            cout << tin[v] << " " << tout[v] << " " << type[v] << " " << siz[v] << " " << father[v] << endl;
//        }
//        cerr << code[v] << " \n"[v == n - 1];
    }
    for (int i = 0; i < n; ++i) {
        Code(i, code[i]);
    }
}

Device

#include "Device.h"
#include <bits/stdc++.h>

using namespace std;

constexpr int B = 63;
constexpr int A0 = 7, A1 = 14;

array<int, 3> query(long long S) {
    if (S % 2 == 0) {
        S /= 2;
        int tin = S & ((1 << A0) - 1);
        int tout = tin + ((S >> A0) & ((1 << A0) - 1));
        int father = (S >> (2 * A0));
        return {tin, tout, father};
    } else {
        S /= 2;
        int tin = S & ((1 << A1) - 1);
        int tout = tin + ((S >> A1) & ((1 << A1) - 1));
        return {tin, tout, -1};
    }
}

void InitDevice() {
}

int Answer(long long S, long long T) {
    auto a = query(S);
    auto b = query(T);
    if (S % 2 == T % 2) {
        if (S % 2 == 0 && a[2] != b[2]) {
            return 2;
        }
        if (a[0] <= b[0] && a[1] >= b[1]) {
            return 1;
        } else if (b[0] <= a[0] && b[1] >= a[1]) {
            return 0;
        } else {
            return 2;
        }
    } else {
        if (S % 2 == 0) {
            if (b[0] <= a[2] && b[1] > a[2]) {
                return 0;
            } else {
                return 2;
            }
        } else {
            if (a[0] <= b[2] && a[1] > b[2]) {
                return 1;
            } else {
                return 2;
            }
        }
    }
    return 0;
}

详细

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 2ms
memory: 5824kb

input:

10 45
0 5
0 2
4 3
6 4
0 6
2 8
6 9
2 1
5 7
5 0
0 2
8 0
0 7
0 6
1 0
4 0
0 3
0 9
5 2
5 8
7 5
5 6
1 5
4 5
5 3
9 5
8 2
7 2
2 6
2 1
2 4
3 2
2 9
7 8
6 8
8 1
8 4
3 8
9 8
6 7
1 7
4 7
3 7
9 7
1 6
6 4
6 3
6 9
4 1
1 3
9 1
3 4
9 4
9 3

output:

2560 266 774 272 526 514 1036 260 264 274 

input:

Interaction has been finished!

output:

0
1
0
1
1
0
0
1
1
2
2
0
2
2
2
2
2
0
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
2
0
2
2
2560

result:

ok 

Test #2:

score: 8
Accepted
time: 2ms
memory: 6140kb

input:

10 45
6 2
0 7
6 9
7 6
0 8
5 4
8 1
7 3
0 5
7 0
0 5
8 0
0 3
6 0
0 1
0 9
4 0
0 2
5 7
8 7
7 3
6 7
7 1
7 9
4 7
7 2
5 8
5 3
5 6
1 5
9 5
4 5
2 5
8 3
6 8
1 8
9 8
8 4
2 8
3 6
3 1
9 3
4 3
2 3
6 1
9 6
4 6
2 6
1 9
1 4
2 1
4 9
9 2
4 2

output:

2560 270 262 266 274 528 772 1282 524 264 

input:

Interaction has been finished!

output:

0
1
0
1
0
1
1
0
1
2
2
1
0
2
1
2
1
2
2
2
2
2
0
2
2
2
0
2
2
2
2
2
2
2
2
2
0
2
0
2
2
2
2
2
2
2560

result:

ok 

Test #3:

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

input:

10 45
0 9
0 7
7 3
6 2
6 1
9 8
6 4
7 5
3 6
7 0
9 0
3 0
0 6
4 0
1 0
8 0
0 2
0 5
9 7
7 3
7 6
7 4
1 7
8 7
2 7
7 5
9 3
9 6
4 9
1 9
8 9
9 2
5 9
3 6
4 3
1 3
3 8
2 3
5 3
4 6
6 1
8 6
2 6
6 5
4 1
4 8
4 2
5 4
8 1
1 2
1 5
2 8
5 8
2 5

output:

2560 270 268 1288 272 274 1034 1798 260 514 

input:

Interaction has been finished!

output:

0
0
0
1
0
0
0
1
1
2
1
1
1
0
2
0
1
2
2
2
2
0
2
2
1
0
0
2
0
2
0
1
2
0
2
2
2
2
2
2
2
2
2
2
2
2560

result:

ok 

Test #4:

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

input:

10 45
3 8
9 6
7 4
7 5
7 9
5 2
0 3
3 1
0 7
7 0
3 0
0 9
6 0
1 0
8 0
0 5
0 2
4 0
7 3
9 7
7 6
1 7
7 8
7 5
2 7
7 4
9 3
6 3
1 3
8 3
5 3
3 2
4 3
9 6
9 1
8 9
5 9
2 9
9 4
1 6
6 8
6 5
2 6
4 6
1 8
5 1
1 2
1 4
8 5
2 8
8 4
5 2
4 5
2 4

output:

2560 262 270 770 266 524 274 1544 260 528 

input:

Interaction has been finished!

output:

0
0
1
0
0
0
1
1
0
2
0
1
2
2
1
0
1
2
2
0
0
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2560

result:

ok 

Test #5:

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

input:

10 45
8 7
6 8
7 0
2 5
9 0
4 5
1 9
3 9
5 7
7 0
0 9
0 5
0 8
3 0
0 1
2 0
4 0
0 6
7 9
7 5
8 7
7 3
1 7
2 7
7 4
6 7
5 9
9 8
3 9
1 9
2 9
9 4
9 6
5 8
5 3
1 5
2 5
5 4
5 6
3 8
1 8
2 8
8 4
6 8
3 1
2 3
4 3
6 3
2 1
1 4
6 1
4 2
6 2
4 6

output:

2560 272 266 274 268 776 262 1538 516 782 

input:

Interaction has been finished!

output:

0
1
1
1
0
1
0
0
1
2
1
0
2
2
0
1
0
2
2
0
0
2
2
2
2
2
2
0
1
2
2
2
2
2
0
2
2
2
2
2
2
2
2
2
2
2560

result:

ok 

Test #6:

score: 8
Accepted
time: 2ms
memory: 5852kb

input:

9 36
3 6
4 3
6 8
4 2
3 1
0 7
0 4
7 5
7 0
5 0
0 4
0 3
2 0
1 0
6 0
0 8
7 5
4 7
3 7
2 7
1 7
6 7
8 7
5 4
5 3
5 2
5 1
6 5
8 5
3 4
4 2
4 1
4 6
8 4
2 3
3 1
6 3
8 3
1 2
2 6
2 8
1 6
8 1
6 8

output:

2304 270 272 1032 1542 260 522 514 268 

input:

Interaction has been finished!

output:

0
0
1
1
0
0
0
1
1
2
2
2
2
2
2
2
2
2
2
2
2
0
1
1
1
0
2
1
0
0
2
2
2
2
2
1
2304

result:

points 1.0

Test #7:

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

input:

10 45
0 5
4 7
4 2
0 4
1 6
0 1
1 8
0 9
9 3
0 1
4 0
2 0
0 8
0 6
0 9
5 0
3 0
7 0
1 4
1 2
8 1
1 6
1 9
5 1
1 3
7 1
2 4
4 8
4 6
9 4
4 5
3 4
4 7
2 8
2 6
9 2
5 2
2 3
7 2
6 8
8 9
8 5
3 8
8 7
9 6
6 5
6 3
6 7
9 5
3 9
9 7
3 5
5 7
3 7

output:

2560 778 264 274 772 258 268 262 270 528 

input:

Interaction has been finished!

output:

1
0
0
1
1
1
0
0
0
2
2
0
1
2
2
2
2
0
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
0
2
2
2
2
2560

result:

ok 

Test #8:

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

input:

5 10
4 1
0 4
0 2
2 3
0 4
2 0
1 0
3 0
2 4
4 1
4 3
1 2
2 3
1 3

output:

1280 260 518 264 514 

input:

Interaction has been finished!

output:

1
0
0
0
2
1
2
2
1
2
1280

result:

points 1.0

Test #9:

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

input:

7 21
4 1
2 5
0 6
0 4
0 2
5 3
0 4
1 0
0 6
0 2
0 5
3 0
4 1
6 4
2 4
4 5
4 3
6 1
1 2
1 5
1 3
2 6
5 6
3 6
2 5
2 3
5 3

output:

1792 262 776 268 516 522 258 

input:

Interaction has been finished!

output:

1
0
1
1
1
0
1
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1792

result:

points 1.0

Test #10:

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

input:

8 28
7 2
2 1
0 3
2 4
7 5
0 7
0 6
0 3
0 6
0 7
0 2
5 0
0 4
0 1
6 3
7 3
2 3
5 3
4 3
1 3
7 6
2 6
6 5
4 6
6 1
7 2
7 5
4 7
1 7
5 2
2 4
1 2
4 5
5 1
4 1

output:

2048 264 774 258 266 268 270 1284 

input:

Interaction has been finished!

output:

1
1
1
1
0
1
1
2
2
2
2
2
2
2
2
2
2
2
1
1
0
0
2
1
0
2
2
2
2048

result:

points 1.0

Test #11:

score: 8
Accepted
time: 2ms
memory: 5832kb

input:

6 15
0 3
1 4
1 5
4 2
0 1
1 0
0 5
4 0
0 3
0 2
1 5
4 1
1 3
2 1
5 4
3 5
5 2
3 4
2 4
3 2

output:

1536 1028 264 258 518 266 

input:

Interaction has been finished!

output:

0
1
0
1
1
1
0
2
0
2
2
2
2
0
2
1536

result:

points 1.0

Test #12:

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

input:

4 6
0 2
2 3
0 1
0 1
0 2
0 3
2 1
3 1
3 2

output:

1024 262 514 260 

input:

Interaction has been finished!

output:

1
1
1
2
2
0
1024

result:

points 1.0

Subtask #2:

score: 92
Accepted

Test #13:

score: 92
Accepted
time: 66ms
memory: 5892kb

input:

700 244650
407 643
680 336
573 208
466 455
159 648
575 549
50 567
251 211
211 481
530 513
136 334
112 492
175 396
643 483
265 132
20 160
174 550
251 90
99 236
579 374
670 613
495 379
251 170
652 61
495 467
27 317
202 484
420 592
542 354
565 650
35 88
216 681
277 219
299 171
220 647
418 433
434 660
2...

output:

557057 295460 491788 393486 524848 328524 524898 295248 360794 524690 492356 295210 393642 131634 524600 492056 327980 524818 524564 164126 361546 38656 393592 328020 360772 328074 196970 131872 131332 524674 164394 491838 525090 491822 524810 334338 393554 196982 360820 131366 296778 393660 393484 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #14:

score: 92
Accepted
time: 58ms
memory: 4736kb

input:

699 243951
59 192
191 301
270 524
135 496
647 573
174 262
662 43
371 50
655 434
123 242
209 46
612 646
11 533
156 443
322 462
329 558
417 383
283 263
615 504
29 520
391 135
546 535
54 264
382 651
541 427
536 456
295 169
645 303
494 21
282 179
329 490
191 67
697 55
226 276
32 160
226 482
392 56
144 1...

output:

589825 524576 524932 491876 295278 131612 295226 492360 492376 492038 427126 557059 98562 164612 524610 361276 426350 426334 459020 98816 429314 164140 524646 557634 66056 557426 558160 361480 524654 558176 131340 427588 198402 100642 295746 65872 165682 459070 459286 459352 164200 426254 559450 459...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #15:

score: 92
Accepted
time: 56ms
memory: 4696kb

input:

700 244650
32 619
369 483
58 148
484 103
190 630
589 659
90 204
515 464
215 254
688 658
454 3
286 582
158 246
90 164
648 13
602 240
237 8
36 620
31 558
515 560
302 39
373 418
288 388
50 516
26 514
190 467
190 439
600 35
258 421
148 214
251 111
50 62
10 530
624 466
666 637
666 692
285 650
137 686
280...

output:

589825 229696 426318 426240 139060 526162 459126 360714 164444 131694 235348 165698 524598 426278 229976 33072 229714 360724 35078 167248 131446 557614 459296 360808 524668 33038 66062 393504 164154 229896 426296 365408 361080 558234 426326 426518 558354 459156 164218 132134 530440 229632 328008 363...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #16:

score: 92
Accepted
time: 56ms
memory: 4688kb

input:

700 244650
230 624
291 145
565 474
12 535
152 335
438 692
136 13
199 155
255 47
546 152
293 254
427 131
71 388
31 231
124 522
503 23
320 545
322 480
674 535
247 415
301 163
226 63
560 367
361 103
391 149
483 661
262 632
337 79
45 59
182 489
526 425
275 369
256 598
42 487
125 63
661 23
181 152
366 29...

output:

655361 328042 622940 624450 328044 524602 262476 262408 164690 139008 393500 362290 624388 132912 492392 32789 367680 233280 165712 231264 526128 590156 623442 237312 590598 590634 364292 524658 393518 360808 131448 360714 626496 524574 131938 492400 622862 328008 495392 590660 262492 263970 328006 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #17:

score: 92
Accepted
time: 120ms
memory: 6824kb

input:

250000 250000
98377 99261
85304 211210
196850 193036
80796 130416
3160 72100
145991 142897
200915 46448
218676 213491
89680 96159
73896 8598
61659 226081
22401 122629
228272 20662
17177 215756
118511 136128
95692 43162
78229 30135
134970 150179
163578 188576
213241 99059
203107 94390
139934 51361
18...

output:

204963841 157647682 203424368 92668162 148766980 50495766 10256750 170459416 155419148 159547716 70287738 176718232 177930782 170426754 48431516 42631456 96436996 3604806 187073092 204047142 179864098 26182158 25919846 44007756 140640888 83460464 38110246 161513840 136053044 48333436 171672082 11665...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #18:

score: 92
Accepted
time: 124ms
memory: 8640kb

input:

250000 250000
58662 187031
88005 38197
22682 178770
111851 15764
207630 198631
64191 185171
168598 129456
142337 237430
215849 182270
211116 93208
20 204879
130122 42963
11672 121189
75991 33257
87185 128123
33289 2936
144056 47212
140138 18041
2913 20891
194901 213077
39452 3187
187440 25628
73551 ...

output:

202375169 178061826 103580064 53084430 1376626 108331322 145394508 188745070 134185240 110264596 170099598 22086770 186155572 119145770 108757858 107525940 114950492 29589918 90735992 54331904 8914702 183795982 86606424 102236524 82248066 16844078 143852202 102859650 29590370 181404242 8717078 19644...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #19:

score: 92
Accepted
time: 128ms
memory: 7864kb

input:

250000 250000
212557 2865
205598 91456
106547 166169
2385 60328
54909 26698
82002 112166
121929 240217
123410 133417
93989 61456
92642 225604
49143 8681
1263 131585
214794 141276
12589 67655
51160 187118
83743 12235
86483 172453
29872 111146
249757 78807
216189 2378
57530 180918
106038 234952
16366 ...

output:

203358209 145391958 32737820 152012874 94175610 178586368 25067814 140575084 74482446 45580560 17301798 128090426 177865216 77309 151159154 34572336 17631776 145950540 191824194 62062894 57246064 104038732 136118570 106201442 93094172 34571616 44664216 69861952 189530474 174883150 176161076 24117566...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #20:

score: 92
Accepted
time: 126ms
memory: 7876kb

input:

250000 250000
108989 180679
6618 123314
146792 97095
101695 18624
109138 21259
130176 235020
131970 224224
32023 110376
126943 90247
7024 8229
55250 106561
44259 206501
157785 107293
88446 38793
62937 119441
158397 243678
83221 104131
184687 105512
101778 195126
76695 8559
31678 182822
58730 237755
...

output:

255983617 178192656 243761956 49709844 230033 254673738 41025908 102859062 64520532 185434412 153518382 188547380 134316346 14745956 30409012 11075856 35103 24084852 47841652 92866370 67076428 219021628 84672868 233275718 23462236 168296774 128189196 157747024 118423916 99354464 203096398 162038124 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #21:

score: 92
Accepted
time: 124ms
memory: 7360kb

input:

250000 250000
128536 214028
128536 203182
145589 67326
128536 148506
128536 118881
128536 221940
128536 82743
128536 76287
128536 207959
128536 126237
128536 33353
143121 245162
128536 140279
128536 149583
128536 146645
119187 41695
128536 122057
128536 1126
128536 97289
239043 83867
17254 163707
12...

output:

137330689 101744938 119898370 63963436 35946818 90800462 57180480 4456788 90308882 95945082 52265336 32047370 15040868 61276496 76513538 72089934 34046284 72745216 98894114 17301792 99156346 71336202 89948444 85819712 29720856 13205802 69435712 59834686 99025198 114524454 108396866 88899948 64684412...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #22:

score: 92
Accepted
time: 128ms
memory: 8552kb

input:

250000 250000
198759 59913
198759 106050
198759 138903
198759 182095
198759 99282
198759 26662
198759 143423
198759 119590
198759 110285
198759 106764
198759 187588
198759 232194
198759 183411
198759 74226
198759 26210
198759 37134
198759 20394
198759 175287
198759 190555
198759 165099
198759 54430
...

output:

130711553 119767302 15925580 4555036 32604420 83558752 104399150 80806260 121209088 81428848 4620584 38011258 83526006 49873178 81756488 8290668 11206980 47743330 70517080 124846404 12157288 104825206 100565344 14123368 19104026 101843270 53870896 29720848 42991874 34013478 108658984 122257686 81527...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #23:

score: 92
Accepted
time: 126ms
memory: 8584kb

input:

250000 250000
184772 157900
184772 132155
184772 166876
184772 64405
184772 137509
184772 4522
184772 200709
184772 35336
184772 206423
184772 164177
184772 75085
184772 43926
184772 203078
184772 111955
184772 143339
184772 48472
184772 203381
184772 124891
184772 53181
184772 233575
184772 191324
...

output:

130482177 18383122 97223012 73990476 87949622 103284994 31752470 13107538 1081716 58130734 7667974 115605874 50004314 62423344 124027254 126976344 87458158 36536616 37093728 78840112 100106510 60129656 63013154 47579496 46891388 852242 94470462 40567092 13861126 75956496 50364744 3014924 56820044 10...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #24:

score: 92
Accepted
time: 116ms
memory: 8580kb

input:

250000 250000
230824 15636
230824 208607
230824 150840
230824 175213
230824 27372
230824 196695
230824 235943
230824 201709
230824 37092
230824 220813
230824 77183
230824 86286
230824 239581
230824 119137
230824 63155
230824 10112
230824 180498
230824 15837
230824 147783
230824 244036
230824 176382
...

output:

130580481 4948262 63537520 120652038 52134184 83460422 63668576 74580308 100041004 30245148 77562154 86245656 46825852 7864622 119243062 102498654 14221682 32964950 59965710 2064672 85262628 92012876 119177508 24871252 52592988 97976652 43843880 66355554 27623798 99909890 104562944 126976286 1143279...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #25:

score: 92
Accepted
time: 126ms
memory: 8320kb

input:

250000 250000
58738 89012
241722 74087
241722 58508
241722 195367
117601 155982
210156 8731
241722 133766
26861 91965
241722 172806
241722 205939
147422 190803
122741 188023
34509 198117
241722 237277
236733 191382
235687 182460
218974 217284
213346 156152
241722 134502
241722 28571
241722 31231
117...

output:

161841153 35138856 72188232 78643492 37749080 53281074 95453492 93389138 148701770 115409190 79855968 85524740 88867090 15696196 51708162 97321318 74023266 137305374 98435400 459172 129171792 83362108 116065662 159613518 61178134 154304812 160039252 40076294 16685418 107807042 56197422 68099 1194068...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #26:

score: 92
Accepted
time: 118ms
memory: 7564kb

input:

250000 250000
26495 54804
17692 109008
175459 12105
214482 13746
240824 131046
65255 113217
55284 75717
149186 198846
77755 108551
161766 100260
200089 208052
79927 67803
166414 91318
49019 16638
50859 113603
112174 66033
82811 201503
95187 31323
55284 191032
168776 146425
55284 243899
55284 109360
...

output:

183992321 139756322 82837824 53904208 117408094 179405570 89621012 123240806 105677068 81431554 167936266 145097048 167182952 34899222 138613252 96076348 119210358 2228546 93227594 13961820 136347984 68161592 83624308 89031066 42271008 135791438 12681532 111640838 41648450 179732782 136581 40337720 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #27:

score: 92
Accepted
time: 66ms
memory: 6256kb

input:

700 244650
275 683
22 179
393 371
237 435
143 394
557 333
541 230
98 280
585 410
289 526
96 82
594 616
228 632
579 661
608 432
442 562
653 561
39 439
401 676
444 681
509 178
94 106
281 608
83 133
71 443
336 396
547 221
133 254
230 498
161 29
492 669
340 312
347 97
191 342
501 573
487 409
611 670
180...

output:

557057 491808 395330 459040 360864 525586 393622 98578 33046 98590 525412 33064 492054 492302 327950 491778 33078 524596 427780 131422 394106 328458 362268 33110 296192 459024 360742 361584 262400 99166 430614 525570 459034 131904 393806 360888 266 438594 328030 32801 524574 426274 394332 426388 986...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #28:

score: 92
Accepted
time: 56ms
memory: 6136kb

input:

700 244650
196 541
32 593
557 166
621 105
508 313
485 554
19 348
240 259
569 527
632 184
512 470
648 185
337 22
508 353
216 471
184 608
435 326
515 458
21 521
295 239
209 258
385 364
46 171
76 672
133 219
188 260
41 691
237 575
425 67
314 136
386 281
12 197
560 230
343 568
445 618
537 146
118 628
24...

output:

557057 164184 164194 196629 33060 131338 270 295524 428554 524 164156 1630 197646 328462 98604 524552 98586 296020 262416 262930 459346 131962 33050 491840 196898 524642 493134 131436 166504 33044 328216 65796 103940 426278 492626 33286 132110 196894 295232 459062 134942 496436 295244 295214 426498 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #29:

score: 92
Accepted
time: 64ms
memory: 5024kb

input:

700 244650
592 352
634 56
500 199
138 39
242 322
130 457
673 471
9 518
342 498
30 580
199 675
341 437
10 42
623 556
9 595
571 363
680 303
638 685
628 334
219 488
6 501
284 18
511 520
607 102
437 618
234 667
561 224
299 291
386 607
584 171
140 166
679 285
559 393
570 546
64 81
361 110
510 117
519 467...

output:

524289 262680 264058 43268 360814 65900 34068 337924 328298 464640 131940 229652 393754 491812 69130 459176 491828 459044 459040 393554 460422 229700 131456 459092 427570 65840 459078 229902 263024 394342 264990 393834 328026 459878 131440 229706 492374 361832 65563 426554 328312 459886 131430 65882...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #30:

score: 92
Accepted
time: 118ms
memory: 8624kb

input:

250000 250000
110488 29915
32503 19122
163234 216779
32503 244838
32503 56235
40340 188891
32503 63368
32503 62093
32503 21241
156372 239088
86337 206334
32503 107656
186415 11721
32503 19412
1401 170501
238830 1975
32503 2536
32503 92576
146518 16823
50563 21743
32503 103708
70942 36214
52807 18384...

output:

129302529 78446892 3440958 98074954 66388552 70615616 59212356 62882144 67699204 22741594 91488628 86737270 22249984 39387412 126583400 22381072 4719208 117276960 21529132 127959624 53215512 40043080 9044332 66945336 10387734 72286782 124027198 45220430 66454048 79298880 81461842 125207114 70222416 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #31:

score: 92
Accepted
time: 118ms
memory: 8032kb

input:

250000 250000
56463 84241
17929 232104
78818 231179
7763 119812
78818 216137
78324 54969
78818 53079
195671 35431
112104 106560
39189 167309
78818 155903
113437 200963
78818 237821
123567 124204
78818 147909
78818 187029
78818 186742
78818 118534
100212 204834
148444 245654
61970 65024
25750 71621
7...

output:

128974849 63701368 111804750 107151884 5439806 55738666 127205956 7897648 94994992 79167812 34636038 91029882 32342346 11141462 16744722 79331650 93225262 96272744 46989666 80773668 106692958 68419944 37192026 27165050 103907626 45777254 53281352 100532606 96928022 84476216 107512166 56656452 425989...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #32:

score: 92
Accepted
time: 116ms
memory: 7048kb

input:

250000 250000
246615 82684
47274 30232
139970 60613
210652 81239
179019 172038
41407 219436
132076 211714
29055 38907
49098 236568
48167 185138
47274 170520
47274 574
87166 134649
18240 198023
47274 32445
28748 188954
177984 156977
227404 152029
95667 40783
47274 237786
47274 57531
47274 110575
4727...

output:

128581633 32997670 109510958 49283338 126157384 49185284 81363266 104399114 10256654 40698166 106070632 77398560 112984392 110625138 106135894 114623012 82936380 71827782 106660416 61964586 49545844 69239094 103809616 35193352 104628522 16253282 126157348 8290900 60293752 16712288 77726026 34701582 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #33:

score: 92
Accepted
time: 116ms
memory: 8120kb

input:

250000 250000
169779 129784
65198 110053
158373 24761
66653 10729
75121 98520
225514 227184
130625 47045
145713 42773
75121 130333
75121 2813
75121 240810
75121 90074
222329 218563
59360 201210
81564 72860
236207 96937
79551 226435
14469 249307
222141 72356
88298 101110
75121 208318
75121 105396
484...

output:

131170305 29262656 57835888 56426786 38338916 115967066 72155448 126452066 27427964 86835504 98763134 129564976 56525068 86508140 76317000 92406102 106627610 9077108 73793798 88932712 122847588 96141652 65503614 111116594 16613666 88867366 113082724 99320430 110756456 44106014 108364038 116294768 10...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #34:

score: 92
Accepted
time: 116ms
memory: 7908kb

input:

250000 250000
41598 211819
178057 8902
41598 25261
159032 170814
178057 51128
108989 52376
178057 120123
33050 191946
162642 212013
41598 26096
127315 209050
182576 43473
178057 120314
41598 46174
140237 131578
166787 88256
178057 208477
228075 235006
2102 72773
11150 206322
179976 14367
181499 7399...

output:

129728513 120521320 121176934 15532382 104104280 80544258 108823338 20087074 90768248 91456280 125403764 59966298 88179244 57082200 21561872 109806172 111018256 56034156 114590524 81920574 117408590 78217778 3113596 93979162 49807952 59965790 49545848 128188936 32309812 76481394 73695492 11043376 15...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #35:

score: 92
Accepted
time: 126ms
memory: 8740kb

input:

250000 250000
163081 132781
63469 11856
30855 50874
182965 210480
165909 208529
182965 69949
19082 85721
145102 24549
63469 98663
63469 230902
182965 247893
91712 244743
182965 246142
63469 92012
51907 109391
111901 86904
63469 12300
104476 112270
35238 54337
52549 37141
182965 87396
130391 140516
6...

output:

129761281 126288724 57278790 29786740 81265516 76415338 93881190 105316932 52789804 48726326 84377866 117277210 4194820 40304966 96076368 67240818 53871148 107610444 107873042 13140330 12222774 89457256 89522502 60588848 7307876 99320340 104825116 64357216 116261456 118981448 71860998 114066200 1274...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #36:

score: 92
Accepted
time: 126ms
memory: 7348kb

input:

250000 250000
209695 203761
124115 27828
226002 88019
177206 117980
53014 34658
79947 249040
192420 90387
105823 50440
227710 118147
68838 70284
192420 168744
28455 61505
2311 93146
192420 12190
103505 37947
211324 154894
212740 208321
132041 90447
48111 234924
192420 180290
192420 120196
104200 491...

output:

129171457 63013166 111903784 4096592 22315374 30409568 15991086 70091084 12812614 86574192 19726686 37257560 26837540 24346914 80151322 20414746 72057454 91685896 34046236 105186312 98796044 99189514 75891768 42861100 81298186 99582730 41386558 125797194 786718 35980074 67043588 33718562 30442240 41...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #37:

score: 92
Accepted
time: 116ms
memory: 7468kb

input:

250000 250000
26171 185351
39348 11884
58623 154119
29392 210049
225461 13141
210462 239794
89337 158657
64038 226543
225461 165057
155662 236975
199438 169618
2656 123195
89755 217180
108157 40495
78088 16550
225461 101981
182908 74529
88887 167252
234346 52597
86586 112414
225461 73242
234252 2080...

output:

128253953 80806968 26214956 53150530 96830262 33260354 35750178 27656536 95716434 27853640 78545746 54722886 125600048 54985022 102499624 112854108 120652060 43975526 31490356 8618254 73466476 4849994 127959354 95748938 3637848 89358660 5374326 120815960 7012630 78283062 100892946 58032700 112460070...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #38:

score: 92
Accepted
time: 124ms
memory: 7240kb

input:

250000 250000
110575 244888
185589 68626
9376 216813
144676 137788
100619 78212
211391 66989
35209 243254
20195 144006
196216 87366
185399 121645
194646 130354
54752 290
224640 85825
25675 41656
146244 90139
28927 68073
132399 6516
77706 91331
84625 151745
9376 84716
242992 193078
238102 220734
2181...

output:

127107073 14516532 93553208 91193960 127074594 110527576 35914260 28311890 18317626 100729678 52658796 25297234 65176424 7209246 47710820 33063698 115802402 54919994 114000718 11829526 40961040 63833444 119211568 121439490 89882986 48267780 47088196 31949314 73172234 80511260 14516798 97157966 12747...

input:

Interaction has been finished!

output:

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

result:

points 1.0

Test #39:

score: 92
Accepted
time: 116ms
memory: 7204kb

input:

250000 250000
243362 29519
185329 174397
40158 169929
115163 94741
41201 214325
91993 61762
227404 228662
200708 3028
176550 161431
243362 183064
202244 84426
231033 143840
220682 231042
144308 210950
33871 71003
179193 137456
124230 121297
199243 15562
9791 220563
92161 54686
127414 130262
127103 2...

output:

128188417 5964118 41058648 9503258 6521134 76612698 79757904 86509354 127698706 112396066 22381076 52528748 79004762 68354362 22152240 13238876 18809388 119474018 8782108 120816458 85131870 110690590 4391532 62193942 23233576 70518272 62719234 36012640 120324414 61703184 46727950 34211162 127108866 ...

input:

Interaction has been finished!

output:

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

result:

points 1.0