QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#462610#8726. Magic Showhhoppitree0 0ms1872kbC++17932b2024-07-03 22:09:132024-07-03 22:09:13

Judging History

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

  • [2024-07-03 22:09:13]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:1872kb
  • [2024-07-03 22:09:13]
  • 提交

Alice

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

using namespace std;

vector< pair<int, int> > Alice() {
    long long x = setN(5000);
    vector< pair<int, int> > E;
    for (int i = 2; i <= 5000; ++i) E.push_back({x % (i - 1) + 1, i});
    return E;
}

Bob

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

using namespace std;

long long exgcd(long long a, long long b, long long &x, long long &y) {
    if (!b) {x = 1, y = 0; return a;}
    long long d = exgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

long long Bob(vector< pair<int, int> > E) {
    __int128 K = -1, B = -1;
    for (auto [b, k] : E) {
        --b, --k;
        if (!~K) {
            K = k, B = b;
            continue;
        }
        long long x, y, d = exgcd(K, -k, x, y);
        __int128 tK = K * k / d;
        B = (B + x * (b - B) / d * K % tK + tK) % tK, K = tK;
        if (K + B > 1e18) break;
    }
    return B;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1848kb

input:

1
4005

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
2 5
1 6
4 7
2 8
6 9
1 10
6 11
2 12
10 13
2 14
2 15
1 16
6 17
11 18
10 19
16 20
6 21
16 22
2 23
4 24
22 25
6 26
2 27
10 28
2 29
4 30
16 31
7 32
6 33
13 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
2 5
1 6
4 7
2 8
6 9
1 10
6 11
2 12
10 13
2 14
2 15
1 16
6 17
11 18
10 19
16 20
6 21
16 22
2 23
4 24
22 25
6 26
2 27
10 28
2 29
4 30
16 31
7 32
6 33
13 3...

output:

2
5000 4946
1 2
1 4
1 6
1 10
1 16
1 46
1 90
1 268
1 446
1 802
1 1336
1 4006
2 3
2 5
2 8
2 12
2 14
2 15
2 23
2 27
2 29
2 45
2 53
2 78
2 92
2 144
2 155
2 183
2 287
2 309
2 365
2 573
2 1002
2 2003
2 4005
3 4004
4 7
4 24
4 30
4 47
4 59
4 70
4 88
4 139
4 175
4 668
4 1335
4 2002
4 4003
5 4002
6 9
6 11
6 1...

input:

2
5000 4946
1 2
1 4
1 6
1 10
1 16
1 46
1 90
1 268
1 446
1 802
1 1336
1 4006
2 3
2 5
2 8
2 12
2 14
2 15
2 23
2 27
2 29
2 45
2 53
2 78
2 92
2 144
2 155
2 183
2 287
2 309
2 365
2 573
2 1002
2 2003
2 4005
3 4004
4 7
4 24
4 30
4 47
4 59
4 70
4 88
4 139
4 175
4 668
4 1335
4 2002
4 4003
5 4002
6 9
6 11
6 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1844kb

input:

1
459

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
4 5
5 6
4 7
5 8
4 9
1 10
10 11
9 12
4 13
5 14
12 15
10 16
12 17
1 18
10 19
4 20
20 21
19 22
20 23
23 24
4 25
10 26
18 27
1 28
12 29
25 30
10 31
26 32
12...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
4 5
5 6
4 7
5 8
4 9
1 10
10 11
9 12
4 13
5 14
12 15
10 16
12 17
1 18
10 19
4 20
20 21
19 22
20 23
23 24
4 25
10 26
18 27
1 28
12 29
25 30
10 31
26 32
12...

output:

2
5000 4946
1 2
1 4
1 10
1 18
1 28
1 52
1 154
1 460
2 3
2 230
2 459
3 458
4 5
4 7
4 9
4 13
4 20
4 25
4 39
4 58
4 77
4 115
4 153
4 229
4 457
5 6
5 8
5 14
5 36
5 66
5 92
5 456
6 228
6 455
7 152
7 454
8 114
8 227
8 453
9 12
9 42
9 452
10 11
10 16
10 19
10 26
10 31
10 46
10 51
10 76
10 91
10 151
10 226
...

input:

2
5000 4946
1 2
1 4
1 10
1 18
1 28
1 52
1 154
1 460
2 3
2 230
2 459
3 458
4 5
4 7
4 9
4 13
4 20
4 25
4 39
4 58
4 77
4 115
4 153
4 229
4 457
5 6
5 8
5 14
5 36
5 66
5 92
5 456
6 228
6 455
7 152
7 454
8 114
8 227
8 453
9 12
9 42
9 452
10 11
10 16
10 19
10 26
10 31
10 46
10 51
10 76
10 91
10 151
10 226
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1848kb

input:

1
2495

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
1 6
6 7
4 8
8 9
3 10
6 11
10 12
12 13
13 14
4 15
6 16
16 17
14 18
12 19
7 20
16 21
18 22
10 23
12 24
24 25
21 26
26 27
12 28
4 29
2 30
6 31
16 32
32...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
3 4
4 5
1 6
6 7
4 8
8 9
3 10
6 11
10 12
12 13
13 14
4 15
6 16
16 17
14 18
12 19
7 20
16 21
18 22
10 23
12 24
24 25
21 26
26 27
12 28
4 29
2 30
6 31
16 32
32...

output:

2
5000 4946
1 2
1 6
1 500
1 2496
2 3
2 30
2 44
2 59
2 87
2 1248
2 2495
3 4
3 10
3 278
3 832
3 2494
4 5
4 8
4 15
4 29
4 90
4 179
4 357
4 624
4 1247
4 2493
5 48
5 54
5 2492
6 7
6 11
6 16
6 31
6 84
6 167
6 250
6 416
6 499
6 831
6 1246
6 2491
7 20
7 132
7 2490
8 9
8 312
8 623
8 1245
8 2489
9 830
9 2488
...

input:

2
5000 4946
1 2
1 6
1 500
1 2496
2 3
2 30
2 44
2 59
2 87
2 1248
2 2495
3 4
3 10
3 278
3 832
3 2494
4 5
4 8
4 15
4 29
4 90
4 179
4 357
4 624
4 1247
4 2493
5 48
5 54
5 2492
6 7
6 11
6 16
6 31
6 84
6 167
6 250
6 416
6 499
6 831
6 1246
6 2491
7 20
7 132
7 2490
8 9
8 312
8 623
8 1245
8 2489
9 830
9 2488
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1820kb

input:

3
1560

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
1 4
1 5
1 6
1 7
7 8
1 9
4 10
1 11
10 12
1 13
1 14
7 15
1 16
9 17
14 18
13 19
3 20
1 21
7 22
21 23
20 24
1 25
11 26
1 27
22 28
21 29
24 30
1 31
11 32
25 33
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
1 4
1 5
1 6
1 7
7 8
1 9
4 10
1 11
10 12
1 13
1 14
7 15
1 16
9 17
14 18
13 19
3 20
1 21
7 22
21 23
20 24
1 25
11 26
1 27
22 28
21 29
24 30
1 31
11 32
25 33
1...

output:

4
5000 3438
1 1561
1561 1562
1561 1563
1561 1564
1561 1565
1561 1566
1561 1567
1561 1568
1561 1569
1561 1570
1561 1571
1561 1572
1561 1573
1561 1574
1561 1575
1561 1576
1561 1577
1561 1578
1561 1579
1561 1580
1561 1581
1561 1582
1561 1583
1561 1584
1561 1585
1561 1586
1561 1587
1561 1588
1561 1589
1...

input:

4
5000 3438
1 1561
1561 1562
1561 1563
1561 1564
1561 1565
1561 1566
1561 1567
1561 1568
1561 1569
1561 1570
1561 1571
1561 1572
1561 1573
1561 1574
1561 1575
1561 1576
1561 1577
1561 1578
1561 1579
1561 1580
1561 1581
1561 1582
1561 1583
1561 1584
1561 1585
1561 1586
1561 1587
1561 1588
1561 1589
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1808kb

input:

3
3594

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
1 4
3 5
5 6
1 7
4 8
3 9
4 10
5 11
9 12
7 13
7 14
11 15
10 16
11 17
8 18
13 19
4 20
15 21
4 22
9 23
7 24
19 25
20 26
7 27
4 28
11 29
28 30
25 31
30 32
11 33
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
1 4
3 5
5 6
1 7
4 8
3 9
4 10
5 11
9 12
7 13
7 14
11 15
10 16
11 17
8 18
13 19
4 20
15 21
4 22
9 23
7 24
19 25
20 26
7 27
4 28
11 29
28 30
25 31
30 32
11 33
...

output:

4
5000 2500
1 3595
2 3594
12 3584
14 3582
24 3572
36 3560
38 3558
48 3548
54 3542
56 3540
62 3534
66 3530
68 3528
78 3518
84 3512
96 3500
104 3492
114 3482
126 3470
128 3468
132 3464
134 3462
138 3458
146 3450
162 3434
164 3432
168 3428
182 3414
188 3408
192 3404
194 3402
198 3398
204 3392
206 3390
...

input:

4
5000 2500
1 3595
2 3594
12 3584
14 3582
24 3572
36 3560
38 3558
48 3548
54 3542
56 3540
62 3534
66 3530
68 3528
78 3518
84 3512
96 3500
104 3492
114 3482
126 3470
128 3468
132 3464
134 3462
138 3458
146 3450
162 3434
164 3432
168 3428
182 3414
188 3408
192 3404
194 3402
198 3398
204 3392
206 3390
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 0
Wrong Answer
time: 0ms = 0ms + 0ms
memory: 1872kb,1816kb

input:

3
1750

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
2 4
3 5
1 6
5 7
1 8
7 9
5 10
1 11
2 12
11 13
9 14
1 15
11 16
7 17
17 18
5 19
3 20
11 21
8 22
13 23
3 24
23 25
1 26
9 27
23 28
15 29
11 30
11 31
15 32
23 33
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
1 3
2 4
3 5
1 6
5 7
1 8
7 9
5 10
1 11
2 12
11 13
9 14
1 15
11 16
7 17
17 18
5 19
3 20
11 21
8 22
13 23
3 24
23 25
1 26
9 27
23 28
15 29
11 30
11 31
15 32
23 33
...

output:

4
5000 3248
1 1751
1751 1752
1751 1753
1751 1754
1751 1755
1751 1756
1751 1757
1751 1758
1751 1759
1751 1760
1751 1761
1751 1762
1751 1763
1751 1764
1751 1765
1751 1766
1751 1767
1751 1768
1751 1769
1751 1770
1751 1771
1751 1772
1751 1773
1751 1774
1751 1775
1751 1776
1751 1777
1751 1778
1751 1779
1...

input:

4
5000 3248
1 1751
1751 1752
1751 1753
1751 1754
1751 1755
1751 1756
1751 1757
1751 1758
1751 1759
1751 1760
1751 1761
1751 1762
1751 1763
1751 1764
1751 1765
1751 1766
1751 1767
1751 1768
1751 1769
1751 1770
1751 1771
1751 1772
1751 1773
1751 1774
1751 1775
1751 1776
1751 1777
1751 1778
1751 1779
1...

output:

9ff923928e5675d6f7ae686fcfb20beac84bc7b1a47cf13bde24b59497bcae3b4900097049e1c568aa409defdbadf4cfc599c0e496e22068170cce547295ffa4
Incorrect answer.

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1844kb

input:

1
17476204

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
1 5
5 6
5 7
5 8
5 9
5 10
5 11
10 12
5 13
6 14
5 15
5 16
13 17
1 18
5 19
5 20
5 21
5 22
21 23
23 24
5 25
5 26
19 27
23 28
5 29
22 30
5 31
17 32
13 33
32 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
1 5
5 6
5 7
5 8
5 9
5 10
5 11
10 12
5 13
6 14
5 15
5 16
13 17
1 18
5 19
5 20
5 21
5 22
21 23
23 24
5 25
5 26
19 27
23 28
5 29
22 30
5 31
17 32
13 33
32 ...

output:

2
5000 4946
1 2
1 3
1 5
1 18
1 35
1 69
2 4
2 108
2 322
4 1188
5 6
5 7
5 8
5 9
5 10
5 11
5 13
5 15
5 16
5 19
5 20
5 21
5 22
5 25
5 26
5 29
5 31
5 36
5 37
5 39
5 41
5 43
5 46
5 51
5 57
5 58
5 61
5 64
5 71
5 73
5 74
5 76
5 77
5 85
5 91
5 96
5 101
5 106
5 115
5 121
5 127
5 134
5 141
5 147
5 151
5 153
5 ...

input:

2
5000 4946
1 2
1 3
1 5
1 18
1 35
1 69
2 4
2 108
2 322
4 1188
5 6
5 7
5 8
5 9
5 10
5 11
5 13
5 15
5 16
5 19
5 20
5 21
5 22
5 25
5 26
5 29
5 31
5 36
5 37
5 39
5 41
5 43
5 46
5 51
5 57
5 58
5 61
5 64
5 71
5 73
5 74
5 76
5 77
5 85
5 91
5 96
5 101
5 106
5 115
5 121
5 127
5 134
5 141
5 147
5 151
5 153
5 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1840kb

input:

1
11926600

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
1 5
1 6
5 7
1 8
1 9
8 10
1 11
5 12
5 13
11 14
1 15
11 16
9 17
13 18
17 19
16 20
1 21
8 22
5 23
20 24
17 25
1 26
11 27
26 28
1 29
3 30
11 31
2 32
9 33
5 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
2 4
1 5
1 6
5 7
1 8
1 9
8 10
1 11
5 12
5 13
11 14
1 15
11 16
9 17
13 18
17 19
16 20
1 21
8 22
5 23
20 24
17 25
1 26
11 27
26 28
1 29
3 30
11 31
2 32
9 33
5 ...

output:

2
5000 4946
1 2
1 3
1 5
1 6
1 8
1 9
1 11
1 15
1 21
1 26
1 29
1 36
1 41
1 50
1 51
1 57
1 71
1 99
1 101
1 141
1 176
1 197
1 201
1 246
1 281
1 351
1 393
1 491
1 701
1 981
1 1218
1 1226
1 1401
1 1961
1 2435
1 2451
1 4869
1 4901
2 4
2 32
2 94
2 258
2 500
2 1498
3 30
3 59
3 62
3 123
3 1770
3 3372
3 3539
4...

input:

2
5000 4946
1 2
1 3
1 5
1 6
1 8
1 9
1 11
1 15
1 21
1 26
1 29
1 36
1 41
1 50
1 51
1 57
1 71
1 99
1 101
1 141
1 176
1 197
1 201
1 246
1 281
1 351
1 393
1 491
1 701
1 981
1 1218
1 1226
1 1401
1 1961
1 2435
1 2451
1 4869
1 4901
2 4
2 32
2 94
2 258
2 500
2 1498
3 30
3 59
3 62
3 123
3 1770
3 3372
3 3539
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1844kb

input:

1
16602378

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
1 4
3 5
4 6
1 7
3 8
3 9
7 10
9 11
2 12
7 13
1 14
3 15
4 16
11 17
9 18
7 19
8 20
19 21
10 22
13 23
13 24
19 25
4 26
1 27
25 28
3 29
24 30
19 31
19 32
11 33
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
1 3
1 4
3 5
4 6
1 7
3 8
3 9
7 10
9 11
2 12
7 13
1 14
3 15
4 16
11 17
9 18
7 19
8 20
19 21
10 22
13 23
13 24
19 25
4 26
1 27
25 28
3 29
24 30
19 31
19 32
11 33
1...

output:

2
5000 4946
1 2
1 3
1 4
1 7
1 14
1 27
1 40
1 79
2 12
3 5
3 8
3 9
3 15
3 29
3 42
3 50
3 57
3 83
3 99
3 165
3 197
3 288
3 329
3 393
3 575
3 1034
3 1149
3 2010
3 2067
3 2297
3 4019
3 4133
4 6
4 16
4 26
4 76
4 126
4 376
5 48
5 95
5 240
5 479
5 740
5 1479
6 2418
7 10
7 13
7 19
7 37
7 198
7 395
7 592
7 78...

input:

2
5000 4946
1 2
1 3
1 4
1 7
1 14
1 27
1 40
1 79
2 12
3 5
3 8
3 9
3 15
3 29
3 42
3 50
3 57
3 83
3 99
3 165
3 197
3 288
3 329
3 393
3 575
3 1034
3 1149
3 2010
3 2067
3 2297
3 4019
3 4133
4 6
4 16
4 26
4 76
4 126
4 376
5 48
5 95
5 240
5 479
5 740
5 1479
6 2418
7 10
7 13
7 19
7 37
7 198
7 395
7 592
7 78...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1800kb

input:

3
13129243

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
2 4
4 5
4 6
2 7
2 8
4 9
8 10
4 11
7 12
8 13
11 14
2 15
14 16
12 17
8 18
8 19
16 20
4 21
2 22
18 23
16 24
20 25
19 26
24 27
8 28
16 29
16 30
14 31
31 32
28 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
2 4
4 5
4 6
2 7
2 8
4 9
8 10
4 11
7 12
8 13
11 14
2 15
14 16
12 17
8 18
8 19
16 20
4 21
2 22
18 23
16 24
20 25
19 26
24 27
8 28
16 29
16 30
14 31
31 32
28 3...

output:

4
5000 2500
6 468
6 935
7 12
9 36
10 1227
11 44
12 17
17 374
17 1120
17 3358
17 3912
19 42
19 1026
21 264
23 108
23 322
23 750
23 2248
24 27
24 66
24 131
24 261
25 2730
25 4812
28 33
28 65
28 129
28 257
28 513
33 60
33 1154
36 948
36 1734
36 1895
36 3467
36 3789
37 50
37 638
38 168
38 335
38 502
38 ...

input:

4
5000 2500
6 468
6 935
7 12
9 36
10 1227
11 44
12 17
17 374
17 1120
17 3358
17 3912
19 42
19 1026
21 264
23 108
23 322
23 750
23 2248
24 27
24 66
24 131
24 261
25 2730
25 4812
28 33
28 65
28 129
28 257
28 513
33 60
33 1154
36 948
36 1734
36 1895
36 3467
36 3789
37 50
37 638
38 168
38 335
38 502
38 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1808kb

input:

3
7892141

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
2 5
2 6
6 7
6 8
6 9
6 10
2 11
5 12
6 13
11 14
6 15
12 16
14 17
11 18
6 19
17 20
2 21
6 22
16 23
14 24
6 25
17 26
24 27
15 28
6 29
24 30
12 31
7 32
14 33...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
3 4
2 5
2 6
6 7
6 8
6 9
6 10
2 11
5 12
6 13
11 14
6 15
12 16
14 17
11 18
6 19
17 20
2 21
6 22
16 23
14 24
6 25
17 26
24 27
15 28
6 29
24 30
12 31
7 32
14 33...

output:

4
5000 2500
1 200
3 4
4 84
4 167
5 12
5 408
9 558
9 1672
9 4724
11 42
12 16
12 31
16 23
19 878
25 2714
25 2910
26 548
26 1095
26 2189
26 3608
29 858
30 49
32 359
32 896
32 1791
32 4410
33 228
33 2044
33 3864
37 116
37 1496
39 74
39 220
42 46
42 51
42 55
42 61
42 75
42 76
42 80
42 91
42 101
42 109
42...

input:

4
5000 2500
1 200
3 4
4 84
4 167
5 12
5 408
9 558
9 1672
9 4724
11 42
12 16
12 31
16 23
19 878
25 2714
25 2910
26 548
26 1095
26 2189
26 3608
29 858
30 49
32 359
32 896
32 1791
32 4410
33 228
33 2044
33 3864
37 116
37 1496
39 74
39 220
42 46
42 51
42 55
42 61
42 75
42 76
42 80
42 91
42 101
42 109
42...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1864kb,1804kb

input:

3
21314775

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
4 5
1 6
4 7
7 8
8 9
4 10
6 11
10 12
4 13
2 14
14 15
1 16
8 17
6 18
4 19
6 20
16 21
7 22
10 23
9 24
16 25
1 26
2 27
4 28
28 29
8 30
16 31
13 32
24 33
10 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 2
2 3
1 4
4 5
1 6
4 7
7 8
8 9
4 10
6 11
10 12
4 13
2 14
14 15
1 16
8 17
6 18
4 19
6 20
16 21
7 22
10 23
9 24
16 25
1 26
2 27
4 28
28 29
8 30
16 31
13 32
24 33
10 ...

output:

4
5000 2500
1 112
2 3
2 14
2 27
9 440
9 2112
10 12
10 34
10 67
11 1232
11 3464
12 854
12 1707
12 3413
14 15
17 74
20 87
20 173
25 58
26 51
26 126
26 251
29 1238
34 62
34 123
34 367
35 1268
38 75
38 114
38 227
38 2550
38 4182
39 102
39 240
39 884
41 48
41 612
41 3056
42 138
42 275
42 960
42 1919
53 8...

input:

4
5000 2500
1 112
2 3
2 14
2 27
9 440
9 2112
10 12
10 34
10 67
11 1232
11 3464
12 854
12 1707
12 3413
14 15
17 74
20 87
20 173
25 58
26 51
26 126
26 251
29 1238
34 62
34 123
34 367
35 1268
38 75
38 114
38 227
38 2550
38 4182
39 102
39 240
39 884
41 48
41 612
41 3056
42 138
42 275
42 960
42 1919
53 8...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1804kb

input:

5
5559540

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
1 3
1 4
1 5
1 6
1 7
1 8
5 9
7 10
1 11
9 12
1 13
13 14
1 15
1 16
5 17
14 18
7 19
8 20
1 21
1 22
9 23
4 24
13 25
16 26
13 27
25 28
1 29
9 30
1 31
1 32
21 33
31 34...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
1 3
1 4
1 5
1 6
1 7
1 8
5 9
7 10
1 11
9 12
1 13
13 14
1 15
1 16
5 17
14 18
7 19
8 20
1 21
1 22
9 23
4 24
13 25
16 26
13 27
25 28
1 29
9 30
1 31
1 32
21 33
31 34...

output:

6
5000 2532
1 3
2 2334
2 2384
4 24
4 70
4 198
4 410
4 592
4 1228
4 4532
5 9
5 17
5 48
5 95
5 189
5 377
5 753
6 284
6 1416
6 3930
7 10
7 19
7 74
7 147
7 220
7 439
7 658
7 1315
7 4232
8 20
8 134
13 14
13 25
13 27
13 40
13 53
13 79
13 104
13 105
13 157
13 174
13 207
13 310
13 313
13 347
13 413
13 520
1...

input:

6
5000 2532
1 3
2 2334
2 2384
4 24
4 70
4 198
4 410
4 592
4 1228
4 4532
5 9
5 17
5 48
5 95
5 189
5 377
5 753
6 284
6 1416
6 3930
7 10
7 19
7 74
7 147
7 220
7 439
7 658
7 1315
7 4232
8 20
8 134
13 14
13 25
13 27
13 40
13 53
13 79
13 104
13 105
13 157
13 174
13 207
13 310
13 313
13 347
13 413
13 520
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1804kb

input:

5
9424319

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
6 7
3 8
8 9
6 10
10 11
4 12
12 13
9 14
10 15
15 16
16 17
13 18
6 19
16 20
20 21
3 22
4 23
1 24
24 25
20 26
22 27
24 28
24 29
16 30
30 31
10 32
3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
2 3
3 4
4 5
5 6
6 7
3 8
8 9
6 10
10 11
4 12
12 13
9 14
10 15
15 16
16 17
13 18
6 19
16 20
20 21
3 22
4 23
1 24
24 25
20 26
22 27
24 28
24 29
16 30
30 31
10 32
3...

output:

6
5000 2642
1 2
2 84
2 167
3 4
4 12
4 23
4 45
5 6
6 7
6 19
8 9
10 11
13 18
13 38
13 630
14 60
14 119
15 16
15 34
15 46
15 56
15 80
15 100
15 166
15 238
15 242
15 396
15 496
15 712
15 724
15 870
15 1186
15 1206
15 2170
15 2608
15 2652
15 3556
15 3616
15 4346
17 390
17 2724
17 3462
20 21
20 26
20 51
2...

input:

6
5000 2642
1 2
2 84
2 167
3 4
4 12
4 23
4 45
5 6
6 7
6 19
8 9
10 11
13 18
13 38
13 630
14 60
14 119
15 16
15 34
15 46
15 56
15 80
15 100
15 166
15 238
15 242
15 396
15 496
15 712
15 724
15 870
15 1186
15 1206
15 2170
15 2608
15 2652
15 3556
15 3616
15 4346
17 390
17 2724
17 3462
20 21
20 26
20 51
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 0
Wrong Answer
time: 0ms = 0ms + 0ms
memory: 1868kb,1804kb

input:

5
10955780

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
1 3
3 4
1 5
1 6
3 7
4 8
5 9
9 10
1 11
1 12
9 13
5 14
11 15
6 16
5 17
12 18
9 19
1 20
1 21
18 22
1 23
7 24
21 25
6 26
5 27
18 28
25 29
16 30
21 31
9 32
5 33
12 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2
1 3
3 4
1 5
1 6
3 7
4 8
5 9
9 10
1 11
1 12
9 13
5 14
11 15
6 16
5 17
12 18
9 19
1 20
1 21
18 22
1 23
7 24
21 25
6 26
5 27
18 28
25 29
16 30
21 31
9 32
5 33
12 3...

output:

6
5000 2505
1 5
2 284
3 4
3 7
5 9
5 14
5 27
5 33
5 53
5 65
5 105
5 129
5 209
5 257
5 417
5 513
5 824
5 833
5 1025
5 1647
5 1665
5 3293
5 3329
6 16
6 26
6 76
8 68
8 102
8 1620
10 2478
10 4424
11 15
11 36
11 71
12 18
12 34
12 52
12 60
12 178
12 188
12 332
12 562
12 650
12 994
12 1004
12 1948
12 3010
1...

input:

6
5000 2505
1 5
2 284
3 4
3 7
5 9
5 14
5 27
5 33
5 53
5 65
5 105
5 129
5 209
5 257
5 417
5 513
5 824
5 833
5 1025
5 1647
5 1665
5 3293
5 3329
6 16
6 26
6 76
8 68
8 102
8 1620
10 2478
10 4424
11 15
11 36
11 71
12 18
12 34
12 52
12 60
12 178
12 188
12 332
12 562
12 650
12 994
12 1004
12 1948
12 3010
1...

output:

9ff923928e5675d6f7ae686fcfb20beac84bc7b1a47cf13bde24b59497bcae3b4900097049e1c568aa409defdbadf4cfc599c0e496e22068170cce547295ffa4
Incorrect answer.

Subtask #3:

score: 0
Wrong Answer

Test #25:

score: 0
Wrong Answer
time: 0ms = 0ms + 0ms
memory: 1868kb,1844kb

input:

1
355365355024496523

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
4 5
4 6
4 7
1 8
4 9
4 10
4 11
4 12
4 13
6 14
8 15
4 16
12 17
15 18
4 19
19 20
4 21
1 22
4 23
10 24
4 25
24 26
6 27
13 28
8 29
11 30
4 31
7 32
12 33
4 34...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2
2 3
1 4
4 5
4 6
4 7
1 8
4 9
4 10
4 11
4 12
4 13
6 14
8 15
4 16
12 17
15 18
4 19
19 20
4 21
1 22
4 23
10 24
4 25
24 26
6 27
13 28
8 29
11 30
4 31
7 32
12 33
4 34...

output:

2
5000 4946
1 2
1 4
1 8
1 22
1 380
1 1138
1 2654
2 3
3 258
4 5
4 6
4 7
4 9
4 10
4 11
4 12
4 13
4 16
4 19
4 21
4 23
4 25
4 31
4 34
4 37
4 41
4 45
4 46
4 56
4 61
4 67
4 73
4 89
4 91
4 100
4 111
4 121
4 133
4 166
4 181
4 199
4 221
4 265
4 284
4 331
4 361
4 397
4 441
4 496
4 567
4 661
4 793
4 850
4 991
...

input:

2
5000 4946
1 2
1 4
1 8
1 22
1 380
1 1138
1 2654
2 3
3 258
4 5
4 6
4 7
4 9
4 10
4 11
4 12
4 13
4 16
4 19
4 21
4 23
4 25
4 31
4 34
4 37
4 41
4 45
4 46
4 56
4 61
4 67
4 73
4 89
4 91
4 100
4 111
4 121
4 133
4 166
4 181
4 199
4 221
4 265
4 284
4 331
4 361
4 397
4 441
4 496
4 567
4 661
4 793
4 850
4 991
...

output:

9ff923928e5675d6f7ae686fcfb20beac84bc7b1a47cf13bde24b59497bcae3b4900097049e1c568aa409defdbadf4cfc599c0e496e22068170cce547295ffa4
Incorrect answer.