QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#415856#8343. 玩游戏marher70 14ms5400kbC++14660b2024-05-21 11:49:452024-05-21 11:49:46

Judging History

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

  • [2024-05-21 11:49:46]
  • 评测
  • 测评结果:70
  • 用时:14ms
  • 内存:5400kb
  • [2024-05-21 11:49:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int n,mod,t;

void init(int m)
{
    n=m;mod=2*n+1;
    t=4;
}

std::pair<int, int> encode(vector<int> a)
{
    int sum=0;
    sort(a.begin(),a.end());
    for(auto x:a)sum=(sum+x)%mod;
    static bool vis[450000];
    for(int i=0;i<mod;i++)vis[i]=0;
    for(auto x:a)vis[x]=1;
    for(auto x:a)if(vis[(sum-t*x+mod*t)%mod]&&(sum-t*x+mod*t)%mod!=x)
    {
        return make_pair(x,(sum-t*x+mod*t)%mod);
    }
    return make_pair(1000000,1000000);
}

int decode(pair<int, int> a, pair<int, int> b)
{
    int sum=(t*a.first+a.second+t*b.first+b.second)%mod;
    return (mod-sum)%mod;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer on the first run

Test #1:

score: 30
Accepted
time: 11ms
memory: 5316kb

input:

6 16666 16807

output:

6 16666
0 9
7 10
9 5
8 11
0 7
8 11
2 7
4 0
8 5
4 2
5 0
4 1
3 9
4 2
4 11
1 5
11 10
0 7
3 0
2 7
0 10
9 8
1 7
10 11
8 12
0 10
2 8
3 10
1 6
3 0
3 12
0 7
5 2
0 1
4 7
0 6
8 11
6 4
1 5
10 12
6 1
0 3
0 4
1 12
2 10
0 9
4 9
1 12
0 5
2 10
0 3
1 2
1 3
2 11
0 8
7 10
1 10
7 12
1 11
2 0
2 4
0 6
2 3
4 0
5 11
2 10
3...

input:

6 16666
0 9
7 10
9 5
8 11
0 7
8 11
2 7
4 0
8 5
4 2
5 0
4 1
3 9
4 2
4 11
1 5
11 10
0 7
3 0
2 7
0 10
9 8
1 7
10 11
8 12
0 10
2 8
3 10
1 6
3 0
3 12
0 7
5 2
0 1
4 7
0 6
8 11
6 4
1 5
10 12
6 1
0 3
0 4
1 12
2 10
0 9
4 9
1 12
0 5
2 10
0 3
1 2
1 3
2 11
0 8
7 10
1 10
7 12
1 11
2 0
2 4
0 6
2 3
4 0
5 11
2 10
3...

output:

5
7
2
8
10
2
0
3
4
12
11
3
11
1
4
8
3
10
7
4
11
6
12
11
3
4
0
6
11
3
8
12
3
7
10
5
3
0
4
1
6
8
3
5
12
12
11
5
2
7
6
5
6
0
3
0
4
4
2
0
11
4
6
12
10
11
9
6
5
7
8
6
5
12
5
4
11
2
5
10
0
4
9
4
5
5
11
3
7
11
4
3
10
12
2
7
1
7
11
3
2
2
10
6
7
6
12
9
2
1
3
1
10
2
8
7
6
7
6
5
0
1
11
6
11
4
11
8
12
7
6
3
8
1...

result:

ok passed (16666 test cases)

Test #2:

score: 0
Wrong Answer on the first run

input:

7 14285 282475249

output:

7 14285
9 11
2 12
6 14
0 5
2 11
9 1
2 11
0 8
5 3
1 10
2 13
1 11
3 1
0 13
1 8
0 6
8 14
1000000 1000000
0 14
9 6
0 3
5 6
7 8
2 6
6 8
3 2
1 4
0 13
4 10
1 2
4 2
1 0
1 6
5 11
5 6
0 1
3 8
1 14
1 3
4 9
8 11
4 7
1 12
3 10
7 10
1 5
12 3
5 13
2 4
0 7
6 14
7 9
3 13
1 14
3 6
0 10
0 5
1 12
1 8
2 3
0 3
4 6
3 12
0...

input:


output:


result:

wrong answer wa on first run: you used an invalid card 1000000 (test case 9)

Subtask #2:

score: 30
Accepted

Test #6:

score: 30
Accepted
time: 7ms
memory: 4632kb

input:

68876 1 470211272

output:

68876 1
1 105476
0 96099

input:

68876 1
1 105476
0 96099

output:

73927

result:

ok passed (1 test case)

Test #7:

score: 30
Accepted
time: 4ms
memory: 4316kb

input:

58538 1 101027544

output:

58538 1
5 44224
0 69295

input:

58538 1
5 44224
0 69295

output:

3538

result:

ok passed (1 test case)

Test #8:

score: 30
Accepted
time: 7ms
memory: 4372kb

input:

50603 1 1457850878

output:

50603 1
7 33796
4 91687

input:

50603 1
7 33796
4 91687

output:

76887

result:

ok passed (1 test case)

Test #9:

score: 30
Accepted
time: 13ms
memory: 4576kb

input:

33045 3 1458777923

output:

33045 3
1 52962
0 57210
1 36402
9 234
4 56757
1 60181

input:

33045 3
1 52962
0 57210
1 36402
9 234
4 56757
1 60181

output:

22006
29415
15224

result:

ok passed (3 test cases)

Test #10:

score: 30
Accepted
time: 11ms
memory: 4128kb

input:

20970 4 2007237709

output:

20970 4
2 4624
0 32005
0 6082
4 2410
1 16887
2 11549
6 11892
1 34812

input:

20970 4
2 4624
0 32005
0 6082
4 2410
1 16887
2 11549
6 11892
1 34812

output:

5304
33433
13493
37150

result:

ok passed (4 test cases)

Test #11:

score: 30
Accepted
time: 8ms
memory: 4412kb

input:

40786 2 823564440

output:

40786 2
8 8836
0 48994
2 55556
4 70508

input:

40786 2
8 8836
0 48994
2 55556
4 70508

output:

23711
37058

result:

ok passed (2 test cases)

Test #12:

score: 30
Accepted
time: 9ms
memory: 4368kb

input:

59198 1 1115438165

output:

59198 1
2 87443
7 86784

input:

59198 1
2 87443
7 86784

output:

62531

result:

ok passed (1 test case)

Test #13:

score: 30
Accepted
time: 10ms
memory: 5108kb

input:

92994 1 1784484492

output:

92994 1
6 149283
1 92892

input:

92994 1
6 149283
1 92892

output:

129775

result:

ok passed (1 test case)

Test #14:

score: 30
Accepted
time: 11ms
memory: 5396kb

input:

95914 1 74243042

output:

95914 1
15 127139
1 108294

input:

95914 1
15 127139
1 108294

output:

148161

result:

ok passed (1 test case)

Test #15:

score: 30
Accepted
time: 9ms
memory: 4376kb

input:

56585 1 114807987

output:

56585 1
3 97473
1 104809

input:

56585 1
3 97473
1 104809

output:

24044

result:

ok passed (1 test case)

Test #16:

score: 30
Accepted
time: 10ms
memory: 4764kb

input:

49131 2 1137522503

output:

49131 2
5 35105
7 50097
1 58615
5 65595

input:

49131 2
5 35105
7 50097
1 58615
5 65595

output:

13013
72292

result:

ok passed (2 test cases)

Test #17:

score: 30
Accepted
time: 9ms
memory: 4464kb

input:

58330 1 1441282327

output:

58330 1
5 115826
3 104362

input:

58330 1
5 115826
3 104362

output:

13102

result:

ok passed (1 test case)

Test #18:

score: 30
Accepted
time: 11ms
memory: 5400kb

input:

95899 1 16531729

output:

95899 1
4 90655
0 19169

input:

95899 1
4 90655
0 19169

output:

81959

result:

ok passed (1 test case)

Test #19:

score: 30
Accepted
time: 9ms
memory: 4328kb

input:

59202 1 823378840

output:

59202 1
0 64228
8 110878

input:

59202 1
0 64228
8 110878

output:

61672

result:

ok passed (1 test case)

Test #20:

score: 30
Accepted
time: 14ms
memory: 5132kb

input:

91350 1 143542612

output:

91350 1
0 175208
1 88379

input:

91350 1
0 175208
1 88379

output:

101811

result:

ok passed (1 test case)

Test #21:

score: 30
Accepted
time: 7ms
memory: 4320kb

input:

37397 2 896544303

output:

37397 2
4 32568
3 6298
7 19324
1 70124

input:

37397 2
4 32568
3 6298
7 19324
1 70124

output:

35901
60110

result:

ok passed (2 test cases)

Test #22:

score: 30
Accepted
time: 8ms
memory: 4364kb

input:

51165 1 1474833169

output:

51165 1
2 60138
0 15037

input:

51165 1
2 60138
0 15037

output:

27148

result:

ok passed (1 test case)

Test #23:

score: 30
Accepted
time: 9ms
memory: 4568kb

input:

61423 1 1264817709

output:

61423 1
2 78759
4 107817

input:

61423 1
2 78759
4 107817

output:

59094

result:

ok passed (1 test case)

Test #24:

score: 30
Accepted
time: 11ms
memory: 4180kb

input:

15177 6 1998097157

output:

15177 6
3 5721
4 14855
1 4425
2 12736
1 17468
3 5861
0 3233
10 20337
6 6513
1 26687
5 28208
3 12078

input:

15177 6
3 5721
4 14855
1 4425
2 12736
1 17468
3 5861
0 3233
10 20337
6 6513
1 26687
5 28208
3 12078

output:

9751
13182
7010
6745
27482
20392

result:

ok passed (6 test cases)

Test #25:

score: 30
Accepted
time: 10ms
memory: 5100kb

input:

91469 1 1817129560

output:

91469 1
6 11783
2 169664

input:

91469 1
6 11783
2 169664

output:

1460

result:

ok passed (1 test case)

Test #26:

score: 30
Accepted
time: 11ms
memory: 4104kb

input:

7001 14 1131570933

output:

7001 14
6 6816
2 1159
0 13437
5 11660
0 4697
2 6329
0 2560
8 11615
1 13160
6 7399
4 5642
1 309
7 2291
3 7479
2 534
0 13652
6 10859
1 2281
1 1709
0 2771
6 680
0 12828
1 4362
0 5592
0 11168
9 13454
2 1804
5 6301

input:

7001 14
6 6816
2 1159
0 13437
5 11660
0 4697
2 6329
0 2560
8 11615
1 13160
6 7399
4 5642
1 309
7 2291
3 7479
2 534
0 13652
6 10859
1 2281
1 1709
0 2771
6 680
0 12828
1 4362
0 5592
0 11168
9 13454
2 1804
5 6301

output:

5996
2889
2969
13799
7419
8032
4193
13812
835
9519
471
4045
3348
5870

result:

ok passed (14 test cases)

Test #27:

score: 30
Accepted
time: 8ms
memory: 4028kb

input:

13730 7 197493099

output:

13730 7
3 16973
14 2068
3 8631
0 2572
6 21937
1 2049
0 22701
2 14501
7 18941
1 1578
2 23007
3 1653
0 14084
2 6837

input:

13730 7
3 16973
14 2068
3 8631
0 2572
6 21937
1 2049
0 22701
2 14501
7 18941
1 1578
2 23007
3 1653
0 14084
2 6837

output:

8352
16246
3447
17712
6910
2781
6532

result:

ok passed (7 test cases)

Test #28:

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

input:

5908 16 1404280278

output:

5908 16
1 11345
4 1016
2 8183
1 29
4 6319
0 9311
2 7155
7 974
0 14
7 1141
1 1873
4 6327
0 1371
1 7575
1 80
0 795
4 6346
0 4390
0 2366
5 11585
9 8047
1 8537
2 6865
0 4730
1 11683
2 11129
10 11750
3 7847
1 6680
0 4754
0 448
7 9903

input:

5908 16
1 11345
4 1016
2 8183
1 29
4 6319
0 9311
2 7155
7 974
0 14
7 1141
1 1873
4 6327
0 1371
1 7575
1 80
0 795
4 6346
0 4390
0 2366
5 11585
9 8047
1 8537
2 6865
0 4730
1 11683
2 11129
10 11750
3 7847
1 6680
0 4754
0 448
7 9903

output:

11253
3593
7988
3652
10634
3597
2867
10938
1065
9663
7010
214
810
3985
379
1438

result:

ok passed (16 test cases)

Test #29:

score: 30
Accepted
time: 8ms
memory: 4396kb

input:

53685 1 893351816

output:

53685 1
0 76996
8 54600

input:

53685 1
0 76996
8 54600

output:

83114

result:

ok passed (1 test case)

Test #30:

score: 30
Accepted
time: 12ms
memory: 4184kb

input:

29258 3 1505795335

output:

29258 3
1 23302
4 54054
4 242
3 15919
2 30957
3 27847

input:

29258 3
1 23302
4 54054
4 242
3 15919
2 30957
3 27847

output:

39658
42328
58210

result:

ok passed (3 test cases)

Subtask #3:

score: 40
Accepted

Test #31:

score: 40
Accepted
time: 7ms
memory: 4484kb

input:

18 5555 1954899097

output:

18 5555
0 20
8 21
0 9
1 27
5 26
2 6
15 26
1 21
1 11
2 9
9 12
2 10
0 34
6 33
0 24
2 26
6 32
15 27
0 35
1 27
3 21
0 26
7 34
1 31
0 14
8 27
5 17
0 23
7 3
9 33
2 9
3 34
0 34
4 7
0 19
5 20
1 17
9 21
0 13
9 29
1 32
2 0
6 30
12 8
0 33
3 21
19 11
1 15
7 33
5 11
0 17
1 29
0 9
5 27
6 12
5 15
0 36
3 11
4 17
0 ...

input:

18 5555
0 20
8 21
0 9
1 27
5 26
2 6
15 26
1 21
1 11
2 9
9 12
2 10
0 34
6 33
0 24
2 26
6 32
15 27
0 35
1 27
3 21
0 26
7 34
1 31
0 14
8 27
5 17
0 23
7 3
9 33
2 9
3 34
0 34
4 7
0 19
5 20
1 17
9 21
0 13
9 29
1 32
2 0
6 30
12 8
0 33
3 21
19 11
1 15
7 33
5 11
0 17
1 29
0 9
5 27
6 12
5 15
0 36
3 11
4 17
0 ...

output:

1
34
14
0
5
8
20
16
5
8
15
14
1
14
11
11
17
15
33
33
30
1
8
5
19
24
18
3
15
7
11
9
9
15
19
5
7
2
34
7
6
19
6
3
10
7
1
19
32
4
25
24
3
13
7
17
9
36
15
3
5
16
16
17
33
0
28
36
15
21
11
15
30
19
6
0
0
1
3
0
10
34
24
10
33
2
2
4
2
12
35
14
33
29
36
35
11
14
17
21
12
10
29
7
2
30
33
24
25
9
18
36
31
28
1...

result:

ok passed (5555 test cases)

Test #32:

score: 40
Accepted
time: 10ms
memory: 3880kb

input:

995 100 1636807826

output:

995 100
0 1068
3 644
1 1190
0 237
2 163
1 1235
1 1024
3 388
6 43
4 1085
4 292
0 1341
0 1026
1 57
3 1271
7 1479
0 1286
3 193
2 94
0 944
0 1258
7 1168
0 294
1 1645
9 119
2 1067
1 1493
0 825
6 1971
1 1151
0 1043
1 1722
1 408
7 499
1 757
0 630
1 1936
5 16
6 1605
1 1545
15 1236
0 212
0 519
6 978
0 1168
9...

input:

995 100
0 1068
3 644
1 1190
0 237
2 163
1 1235
1 1024
3 388
6 43
4 1085
4 292
0 1341
0 1026
1 57
3 1271
7 1479
0 1286
3 193
2 94
0 944
0 1258
7 1168
0 294
1 1645
9 119
2 1067
1 1493
0 825
6 1971
1 1151
0 1043
1 1722
1 408
7 499
1 757
0 630
1 1936
5 16
6 1605
1 1545
15 1236
0 212
0 519
6 978
0 1168
9...

output:

267
560
581
563
823
342
904
1192
500
945
1528
48
761
1660
832
1213
1052
600
15
804
483
470
1042
360
1595
876
1656
664
314
266
776
1554
1365
1889
719
477
540
1796
1606
56
966
1487
90
345
1117
1828
1128
554
1210
170
1018
898
1357
1650
18
1041
188
1257
68
926
1607
359
669
404
1419
1641
762
1307
657
813...

result:

ok passed (100 test cases)

Test #33:

score: 40
Accepted
time: 6ms
memory: 3836kb

input:

909 110 563613512

output:

909 110
1 182
6 616
0 1171
2 1099
0 1396
3 811
4 215
1 1818
1 579
0 1401
2 810
0 1620
2 1641
4 67
1 316
4 1426
7 780
0 1563
4 548
1 711
5 658
7 1616
0 818
3 777
11 1047
5 706
3 303
1 48
2 1143
0 662
0 1788
8 1079
2 1471
4 228
0 182
2 676
4 598
2 462
11 1754
13 1636
1 1488
2 156
1 777
0 1281
0 1616
3...

input:

909 110
1 182
6 616
0 1171
2 1099
0 1396
3 811
4 215
1 1818
1 579
0 1401
2 810
0 1620
2 1641
4 67
1 316
4 1426
7 780
0 1563
4 548
1 711
5 658
7 1616
0 818
3 777
11 1047
5 706
3 303
1 48
2 1143
0 662
0 1788
8 1079
2 1471
4 228
0 182
2 676
4 598
2 462
11 1754
13 1636
1 1488
2 156
1 777
0 1281
0 1616
3...

output:

993
1360
1419
1585
1654
1200
87
57
1267
540
1316
212
2
1452
6
739
96
953
735
152
163
1576
593
265
470
1253
914
1079
184
1499
855
56
1031
1203
172
534
857
907
1040
924
1600
1775
1461
1009
440
1015
1042
1755
1694
123
820
176
1389
754
973
1181
508
1507
707
1573
1549
846
1361
1388
720
563
303
54
1534
46...

result:

ok passed (110 test cases)

Test #34:

score: 40
Accepted
time: 9ms
memory: 3868kb

input:

748 133 101929267

output:

748 133
4 1386
3 199
11 333
2 1250
4 438
2 482
1 345
3 905
2 1311
4 560
1 833
3 347
2 38
0 1063
2 282
13 995
3 790
7 1235
3 1190
0 475
2 448
0 381
0 1082
4 142
10 370
3 505
2 718
0 1098
7 1099
1 881
4 318
3 109
4 654
2 946
2 798
0 210
3 1183
0 525
0 1097
1 1147
3 1238
2 1445
0 10
4 303
5 408
3 716
1...

input:

748 133
4 1386
3 199
11 333
2 1250
4 438
2 482
1 345
3 905
2 1311
4 560
1 833
3 347
2 38
0 1063
2 282
13 995
3 790
7 1235
3 1190
0 475
2 448
0 381
0 1082
4 142
10 370
3 505
2 718
0 1098
7 1099
1 881
4 318
3 109
4 654
2 946
2 798
0 210
3 1183
0 525
0 1097
1 1147
3 1238
2 1445
0 10
4 303
5 408
3 716
1...

output:

1381
1359
553
231
1099
301
388
160
929
1317
660
257
570
1170
982
1042
1370
481
1274
746
291
1168
341
182
1143
561
482
1053
1087
899
1359
498
834
708
1130
823
840
225
595
365
425
356
338
343
790
53
621
496
533
166
110
1366
828
1429
263
203
587
965
94
623
777
523
418
48
711
504
923
522
773
1460
644
10...

result:

ok passed (133 test cases)

Test #35:

score: 40
Accepted
time: 9ms
memory: 3776kb

input:

703 142 1580723810

output:

703 142
6 177
0 304
4 801
3 1188
0 1216
3 939
0 298
2 1279
3 622
0 162
3 282
9 1037
13 1252
5 1177
8 319
6 1121
1 966
6 297
4 1012
5 1369
0 74
1 1098
2 1337
0 1171
5 530
2 1194
5 143
1 154
5 737
0 187
2 1269
5 365
10 761
3 352
4 151
0 850
5 517
2 832
1 926
0 1403
2 684
5 298
0 521
2 1115
8 69
0 1358...

input:

703 142
6 177
0 304
4 801
3 1188
0 1216
3 939
0 298
2 1279
3 622
0 162
3 282
9 1037
13 1252
5 1177
8 319
6 1121
1 966
6 297
4 1012
5 1369
0 74
1 1098
2 1337
0 1171
5 530
2 1194
5 143
1 154
5 737
0 187
2 1269
5 365
10 761
3 352
4 151
0 850
5 517
2 832
1 926
0 1403
2 684
5 298
0 521
2 1115
8 69
0 1358...

output:

902
797
647
1229
611
40
313
1318
116
397
231
298
1062
1086
463
1152
242
390
30
481
397
1170
1355
155
736
1256
1057
908
497
61
209
443
616
28
474
180
1196
56
258
237
505
357
1367
668
1333
313
383
1191
30
180
320
1038
247
223
1081
1064
1340
1008
330
965
963
746
22
1122
816
726
119
1012
305
843
598
941...

result:

ok passed (142 test cases)

Test #36:

score: 40
Accepted
time: 8ms
memory: 3748kb

input:

268 373 704877633

output:

268 373
5 350
0 331
1 53
3 435
1 320
0 188
3 338
2 255
9 201
0 417
1 350
12 158
3 208
1 177
1 314
0 481
13 222
4 143
1 414
0 247
1 61
3 446
1 118
10 520
1 29
2 211
19 69
1 349
2 371
1 493
2 275
1 77
2 81
1 82
0 81
1 132
5 44
1 247
0 473
9 508
1 218
3 296
0 44
1 241
7 510
0 422
2 493
1 433
15 59
2 46...

input:

268 373
5 350
0 331
1 53
3 435
1 320
0 188
3 338
2 255
9 201
0 417
1 350
12 158
3 208
1 177
1 314
0 481
13 222
4 143
1 414
0 247
1 61
3 446
1 118
10 520
1 29
2 211
19 69
1 349
2 371
1 493
2 275
1 77
2 81
1 82
0 81
1 132
5 44
1 247
0 473
9 508
1 218
3 296
0 44
1 241
7 510
0 422
2 493
1 433
15 59
2 46...

output:

373
33
25
461
420
514
136
275
104
409
14
392
285
39
198
173
362
320
222
57
7
248
114
136
479
24
202
501
291
6
396
83
253
268
47
285
61
72
394
405
353
443
281
121
51
145
309
496
362
65
233
51
0
148
207
312
143
196
375
136
70
458
493
190
347
529
524
241
72
401
118
388
521
219
95
103
180
266
455
22
476...

result:

ok passed (373 test cases)

Test #37:

score: 40
Accepted
time: 8ms
memory: 3896kb

input:

171 584 1358580979

output:

171 584
1 315
0 269
1 155
5 341
2 60
0 10
5 47
1 332
4 164
5 263
0 73
1 49
10 315
2 290
3 242
4 142
0 273
1 185
5 334
2 106
0 323
2 238
2 291
0 194
0 107
18 49
0 199
2 221
6 32
0 278
1 242
4 297
1 232
0 308
0 286
3 235
3 96
1 154
6 242
5 260
3 283
0 331
2 236
1 148
7 222
3 317
11 303
0 272
6 140
0 2...

input:

171 584
1 315
0 269
1 155
5 341
2 60
0 10
5 47
1 332
4 164
5 263
0 73
1 49
10 315
2 290
3 242
4 142
0 273
1 185
5 334
2 106
0 323
2 238
2 291
0 194
0 107
18 49
0 199
2 221
6 32
0 278
1 242
4 297
1 232
0 308
0 286
3 235
3 96
1 154
6 242
5 260
3 283
0 331
2 236
1 148
7 222
3 317
11 303
0 272
6 140
0 2...

output:

98
166
265
283
223
217
33
274
224
218
117
193
115
258
9
127
142
153
77
140
60
290
107
67
223
210
254
73
21
156
257
173
132
25
167
332
0
261
26
55
72
137
99
282
5
126
341
32
109
307
68
130
167
173
182
244
128
332
5
132
154
247
320
62
79
13
124
342
332
225
64
136
134
218
307
334
328
294
31
236
42
327
...

result:

ok passed (584 test cases)

Test #38:

score: 40
Accepted
time: 8ms
memory: 4080kb

input:

70 1428 1624379149

output:

70 1428
0 83
1 66
1 71
16 125
3 68
0 115
1 111
0 98
0 55
2 100
5 51
1 110
0 38
3 64
11 118
1 53
9 14
0 58
0 59
9 118
3 104
1 122
5 47
0 73
2 7
4 44
4 87
1 54
0 138
2 59
0 93
4 81
0 26
2 12
1 31
2 35
7 112
8 62
4 84
1 105
2 137
0 118
3 50
9 18
0 58
4 40
4 34
1 81
5 43
1 60
4 77
1 107
0 62
2 63
9 124
...

input:

70 1428
0 83
1 66
1 71
16 125
3 68
0 115
1 111
0 98
0 55
2 100
5 51
1 110
0 38
3 64
11 118
1 53
9 14
0 58
0 59
9 118
3 104
1 122
5 47
0 73
2 7
4 44
4 87
1 54
0 138
2 59
0 93
4 81
0 26
2 12
1 31
2 35
7 112
8 62
4 84
1 105
2 137
0 118
3 50
9 18
0 58
4 40
4 34
1 81
5 43
1 60
4 77
1 107
0 62
2 63
9 124
...

output:

129
18
87
69
119
97
27
63
33
69
40
1
66
121
77
92
95
63
48
73
19
25
27
6
14
78
8
45
12
85
80
44
84
107
6
6
138
38
25
114
99
69
86
13
39
137
3
138
114
45
128
100
97
16
58
44
69
24
98
131
50
112
116
54
25
67
79
52
116
95
93
19
21
63
134
42
118
7
122
57
40
50
43
42
26
78
0
76
35
55
66
105
56
13
33
123
...

result:

ok passed (1428 test cases)

Test #39:

score: 40
Accepted
time: 10ms
memory: 3876kb

input:

950 105 2128236579

output:

950 105
1 1352
5 856
0 464
1 1610
4 248
2 1308
0 50
1 128
1 900
2 109
4 1797
0 1378
0 652
1 1456
2 926
14 322
4 93
2 507
8 1541
0 206
7 758
4 305
4 1047
0 315
0 478
6 1653
9 908
0 827
2 1817
1 1390
7 989
3 1373
3 1628
0 1482
7 937
1 79
4 1552
0 1696
0 638
2 1279
1 432
2 785
2 965
0 1863
0 1710
2 616...

input:

950 105
1 1352
5 856
0 464
1 1610
4 248
2 1308
0 50
1 128
1 900
2 109
4 1797
0 1378
0 652
1 1456
2 926
14 322
4 93
2 507
8 1541
0 206
7 758
4 305
4 1047
0 315
0 478
6 1653
9 908
0 827
2 1817
1 1390
7 989
3 1373
3 1628
0 1482
7 937
1 79
4 1552
0 1696
0 638
2 1279
1 432
2 785
2 965
0 1863
0 1710
2 616...

output:

1570
1724
321
1719
880
611
1690
589
1277
122
794
523
1647
130
583
1400
680
853
538
1877
672
966
1468
652
150
601
1874
1121
489
1862
1694
217
1408
1023
1854
1533
1379
1658
1158
16
130
1021
866
966
1302
1847
864
552
922
579
1180
618
1627
1579
1576
1612
1081
224
604
972
361
349
1579
960
372
1571
552
82...

result:

ok passed (105 test cases)

Test #40:

score: 40
Accepted
time: 10ms
memory: 3840kb

input:

780 128 784558821

output:

780 128
2 1123
0 568
4 516
0 276
4 1333
2 778
8 1203
4 1385
8 431
0 1462
3 24
2 238
3 1317
2 645
3 1097
0 369
1 327
0 1216
0 1442
4 585
2 199
0 952
7 1463
2 54
0 17
4 1273
2 1280
5 165
2 161
1 1472
4 952
6 326
2 621
7 1152
2 491
0 1518
5 596
15 944
3 406
1 918
0 362
1 1137
1 504
0 1205
2 179
6 1536
...

input:

780 128
2 1123
0 568
4 516
0 276
4 1333
2 778
8 1203
4 1385
8 431
0 1462
3 24
2 238
3 1317
2 645
3 1097
0 369
1 327
0 1216
0 1442
4 585
2 199
0 952
7 1463
2 54
0 17
4 1273
2 1280
5 165
2 161
1 1472
4 952
6 326
2 621
7 1152
2 491
0 1518
5 596
15 944
3 406
1 918
0 362
1 1137
1 504
0 1205
2 179
6 1536
...

output:

1423
753
987
486
1197
1279
1140
83
14
1079
402
8
255
88
1477
243
1313
1105
1502
221
58
1409
1375
524
1306
89
610
80
1288
454
1292
297
1219
1454
1148
923
1293
625
1166
829
226
214
1382
1154
696
1352
541
912
1181
855
470
1097
108
1042
860
1540
1538
836
198
1544
942
719
482
1271
996
1351
791
881
462
11...

result:

ok passed (128 test cases)

Test #41:

score: 40
Accepted
time: 6ms
memory: 3780kb

input:

489 204 530511967

output:

489 204
1 739
3 594
4 706
3 736
4 279
0 17
12 142
2 764
2 368
0 945
6 294
0 319
3 622
2 299
0 530
5 384
7 560
3 742
2 908
0 265
7 536
1 426
0 526
6 238
2 340
4 772
0 329
6 37
3 341
1 252
4 803
11 459
1 251
3 530
1 74
5 174
0 370
1 670
4 919
1 316
11 158
1 403
0 590
11 145
0 632
8 58
0 474
2 528
3 50...

input:

489 204
1 739
3 594
4 706
3 736
4 279
0 17
12 142
2 764
2 368
0 945
6 294
0 319
3 622
2 299
0 530
5 384
7 560
3 742
2 908
0 265
7 536
1 426
0 526
6 238
2 340
4 772
0 329
6 37
3 341
1 252
4 803
11 459
1 251
3 530
1 74
5 174
0 370
1 670
4 919
1 316
11 158
1 403
0 590
11 145
0 632
8 58
0 474
2 528
3 50...

output:

609
488
667
17
637
342
38
45
616
777
964
191
822
589
370
636
182
707
914
703
370
200
257
948
233
662
319
368
350
164
634
471
667
524
720
806
459
104
977
847
202
50
40
463
672
852
865
539
658
893
532
944
896
95
492
577
962
940
139
566
40
81
929
412
757
547
245
576
637
89
185
719
510
387
418
161
427
8...

result:

ok passed (204 test cases)

Test #42:

score: 40
Accepted
time: 9ms
memory: 3848kb

input:

879 113 2110010672

output:

879 113
1 100
9 1046
8 218
1 637
0 959
4 878
3 1039
1 305
2 1162
3 49
0 192
4 1282
6 1410
1 494
6 220
3 1194
5 618
1 1399
2 1127
0 112
1 1449
5 1748
0 586
1 1238
0 1583
1 1087
0 1723
10 28
1 1453
6 1483
0 164
1 1113
0 1669
2 239
1 132
0 1237
0 1298
3 981
2 1584
1 625
1 1215
0 485
2 207
3 123
0 937
1...

input:

879 113
1 100
9 1046
8 218
1 637
0 959
4 878
3 1039
1 305
2 1162
3 49
0 192
4 1282
6 1410
1 494
6 220
3 1194
5 618
1 1399
2 1127
0 112
1 1449
5 1748
0 586
1 1238
0 1583
1 1087
0 1723
10 28
1 1453
6 1483
0 164
1 1113
0 1669
2 239
1 132
0 1237
0 1298
3 981
2 1584
1 625
1 1215
0 485
2 207
3 123
0 937
1...

output:

573
868
1665
399
528
269
1586
309
1477
512
297
1690
844
1727
554
478
1602
386
1227
1297
55
1409
1622
1756
880
1590
384
898
933
1664
206
143
829
895
314
1008
1231
168
1296
1273
623
612
319
1191
1147
1442
841
1608
455
353
806
1073
711
416
1520
270
516
359
852
1617
885
162
1417
1631
896
1055
885
674
20...

result:

ok passed (113 test cases)

Test #43:

score: 40
Accepted
time: 6ms
memory: 3784kb

input:

520 192 1551901393

output:

520 192
2 1006
0 678
1 288
7 729
7 78
1 980
8 1035
3 202
1 453
0 38
2 686
0 1003
0 1018
4 1017
2 48
1 511
1 812
6 607
0 947
6 740
1 885
2 460
5 523
10 980
1 663
11 241
6 42
5 336
3 726
0 261
3 11
5 957
2 626
0 371
0 1017
6 821
0 348
3 615
7 192
1 137
0 251
3 953
0 210
2 173
3 671
0 236
1 141
0 675
4...

input:

520 192
2 1006
0 678
1 288
7 729
7 78
1 980
8 1035
3 202
1 453
0 38
2 686
0 1003
0 1018
4 1017
2 48
1 511
1 812
6 607
0 947
6 740
1 885
2 460
5 523
10 980
1 663
11 241
6 42
5 336
3 726
0 261
3 11
5 957
2 626
0 371
0 1017
6 821
0 348
3 615
7 192
1 137
0 251
3 953
0 210
2 173
3 671
0 236
1 141
0 675
4...

output:

390
1033
992
801
546
385
31
470
635
371
725
519
89
619
42
41
36
220
66
680
866
650
122
221
589
947
939
887
197
91
433
70
935
404
481
523
831
789
889
483
264
672
294
434
140
502
15
804
619
217
69
656
854
717
60
459
691
783
713
224
965
935
893
1025
186
437
289
559
632
862
73
1025
578
757
786
778
632
9...

result:

ok passed (192 test cases)

Test #44:

score: 40
Accepted
time: 9ms
memory: 3832kb

input:

647 154 1617819336

output:

647 154
0 1294
2 1157
4 556
3 580
5 911
0 9
1 966
4 1273
0 486
2 420
5 802
0 876
2 338
3 1010
3 950
1 210
3 884
1 758
11 839
4 51
2 61
0 736
0 1212
2 1287
3 92
8 397
3 23
4 582
9 510
0 512
5 1172
0 797
0 1127
1 1265
7 1088
0 255
1 516
5 1099
10 1075
9 298
0 918
1 276
8 60
0 14
2 918
0 1007
0 174
2 6...

input:

647 154
0 1294
2 1157
4 556
3 580
5 911
0 9
1 966
4 1273
0 486
2 420
5 802
0 876
2 338
3 1010
3 950
1 210
3 884
1 758
11 839
4 51
2 61
0 736
0 1212
2 1287
3 92
8 397
3 23
4 582
9 510
0 512
5 1172
0 797
0 1127
1 1265
7 1088
0 255
1 516
5 1099
10 1075
9 298
0 918
1 276
8 60
0 14
2 918
0 1007
0 174
2 6...

output:

131
131
355
331
381
892
1222
119
932
345
490
83
762
662
237
601
194
1219
951
1141
97
1189
657
471
524
106
333
909
1242
572
474
964
1093
244
524
1171
540
429
374
755
681
562
865
802
1047
589
314
341
403
319
855
528
594
59
869
251
347
712
1289
180
1194
1109
713
1289
57
869
2
379
823
459
911
78
1208
17...

result:

ok passed (154 test cases)

Test #45:

score: 40
Accepted
time: 9ms
memory: 3836kb

input:

327 305 1399125485

output:

327 305
28 382
7 149
5 440
3 396
0 171
5 85
0 301
3 349
0 597
4 138
1 478
0 306
7 556
0 345
0 570
2 463
2 101
0 300
0 431
1 173
10 83
2 6
8 378
5 296
1 636
5 71
0 28
3 328
0 436
1 406
1 219
3 543
0 74
1 123
2 609
0 552
7 383
0 391
1 445
6 458
0 412
9 327
6 631
1 47
0 49
2 554
0 262
5 212
3 324
2 148...

input:

327 305
28 382
7 149
5 440
3 396
0 171
5 85
0 301
3 349
0 597
4 138
1 478
0 306
7 556
0 345
0 570
2 463
2 101
0 300
0 431
1 173
10 83
2 6
8 378
5 296
1 636
5 71
0 28
3 328
0 436
1 406
1 219
3 543
0 74
1 123
2 609
0 552
7 383
0 391
1 445
6 458
0 412
9 327
6 631
1 47
0 49
2 554
0 262
5 212
3 324
2 148...

output:

639
442
379
648
559
522
381
269
246
47
518
584
579
287
464
532
454
141
508
379
535
604
44
161
163
489
56
281
607
446
585
76
522
585
75
116
385
350
437
63
152
399
286
558
485
532
352
547
444
386
114
468
382
201
262
37
455
295
155
119
432
96
24
11
70
1
301
444
15
351
64
289
555
570
615
169
175
306
648...

result:

ok passed (305 test cases)

Test #46:

score: 40
Accepted
time: 9ms
memory: 3908kb

input:

595 168 156091745

output:

595 168
0 122
8 838
1 270
0 1173
2 31
0 1081
1 408
2 639
0 138
3 795
0 814
6 651
8 690
9 721
1 462
3 443
3 812
0 237
2 177
1 422
5 927
0 1122
4 471
3 168
14 719
1 815
4 193
2 525
1 1181
0 1164
9 1057
0 1040
2 897
3 173
3 307
1 1122
0 406
3 1007
3 630
1 826
0 53
2 1029
6 934
1 532
0 466
3 546
4 194
0...

input:

595 168
0 122
8 838
1 270
0 1173
2 31
0 1081
1 408
2 639
0 138
3 795
0 814
6 651
8 690
9 721
1 462
3 443
3 812
0 237
2 177
1 422
5 927
0 1122
4 471
3 168
14 719
1 815
4 193
2 525
1 1181
0 1164
9 1057
0 1040
2 897
3 173
3 307
1 1122
0 406
3 1007
3 630
1 826
0 53
2 1029
6 934
1 532
0 466
3 546
4 194
0...

output:

199
935
71
132
246
893
903
270
130
580
313
524
788
449
33
249
101
937
957
910
101
888
167
317
496
976
1143
702
210
1018
753
342
994
992
912
769
357
963
240
958
420
880
690
1086
819
230
223
1149
1096
820
246
807
139
709
1172
581
910
1183
343
338
377
1137
958
865
1020
713
676
1184
42
1175
1004
897
520...

result:

ok passed (168 test cases)

Test #47:

score: 40
Accepted
time: 9ms
memory: 3816kb

input:

676 147 1356425228

output:

676 147
3 216
1 1009
0 139
1 944
2 271
0 675
0 654
3 73
1 1260
0 184
1 978
3 912
2 636
14 794
7 35
5 156
8 256
2 391
1 1049
2 594
1 473
2 1211
0 279
2 502
0 681
10 727
0 1314
2 676
11 310
14 61
1 741
7 1271
1 852
3 241
6 622
3 1245
0 726
2 880
14 665
12 1315
4 607
0 398
3 320
1 1000
7 455
2 845
0 87...

input:

676 147
3 216
1 1009
0 139
1 944
2 271
0 675
0 654
3 73
1 1260
0 184
1 978
3 912
2 636
14 794
7 35
5 156
8 256
2 391
1 1049
2 594
1 473
2 1211
0 279
2 502
0 681
10 727
0 1314
2 676
11 310
14 61
1 741
7 1271
1 852
3 241
6 622
3 1245
0 726
2 880
14 665
12 1315
4 607
0 398
3 320
1 1000
7 455
2 845
0 87...

output:

112
266
399
614
1258
800
1212
1114
666
1051
1010
564
1258
708
882
662
244
803
1092
622
332
17
17
250
730
660
116
522
87
735
245
811
792
1210
1167
1216
1046
190
1
1187
1001
917
970
171
1319
1121
850
477
1025
57
1149
1286
734
678
556
1188
364
762
588
1165
891
680
1134
655
439
917
430
1113
352
394
124
...

result:

ok passed (147 test cases)

Test #48:

score: 40
Accepted
time: 8ms
memory: 3840kb

input:

152 657 1899894091

output:

152 657
2 68
0 71
0 234
4 39
0 181
1 295
3 184
2 91
6 142
1 93
2 111
4 74
2 135
1 39
0 59
2 147
0 250
2 92
1 26
4 151
0 138
3 130
9 156
1 208
0 248
14 244
1 102
0 20
1 257
0 48
4 174
7 209
0 13
1 267
19 124
1 59
0 199
2 266
6 168
0 64
3 232
1 268
2 85
0 6
6 276
1 250
1 65
0 47
5 36
0 243
1 204
15 14...

input:

152 657
2 68
0 71
0 234
4 39
0 181
1 295
3 184
2 91
6 142
1 93
2 111
4 74
2 135
1 39
0 59
2 147
0 250
2 92
1 26
4 151
0 138
3 130
9 156
1 208
0 248
14 244
1 102
0 20
1 257
0 48
4 174
7 209
0 13
1 267
19 124
1 59
0 199
2 266
6 168
0 64
3 232
1 268
2 85
0 6
6 276
1 250
1 65
0 47
5 36
0 243
1 204
15 14...

output:

158
16
130
10
42
96
119
91
260
108
25
206
62
179
301
183
21
42
137
49
94
206
56
189
6
193
72
151
53
215
118
127
103
245
83
145
213
265
16
88
136
15
257
21
22
100
49
121
82
116
82
243
194
295
107
218
31
42
289
105
55
245
229
292
275
168
131
206
253
291
97
95
185
173
90
5
161
207
244
58
230
185
220
16...

result:

ok passed (657 test cases)

Test #49:

score: 40
Accepted
time: 9ms
memory: 3816kb

input:

603 165 585640194

output:

603 165
0 206
6 338
18 789
1 1092
1 579
0 395
2 434
3 898
0 689
1 255
0 1091
4 1064
0 425
2 1085
1 1026
0 1188
0 1205
5 680
0 851
1 208
1 1041
0 61
1 465
4 1126
2 422
0 410
2 399
3 302
4 1170
1 290
4 513
1 219
0 834
1 1175
1 165
4 1012
0 696
2 1040
1 928
2 167
0 817
2 839
0 735
1 916
10 552
0 784
0 ...

input:

603 165
0 206
6 338
18 789
1 1092
1 579
0 395
2 434
3 898
0 689
1 255
0 1091
4 1064
0 425
2 1085
1 1026
0 1188
0 1205
5 680
0 851
1 208
1 1041
0 61
1 465
4 1126
2 422
0 410
2 399
3 302
4 1170
1 290
4 513
1 219
0 834
1 1175
1 165
4 1012
0 696
2 1040
1 928
2 167
0 817
2 839
0 735
1 916
10 552
0 784
0 ...

output:

639
457
229
1062
259
243
896
196
509
144
101
803
367
486
934
455
401
10
670
100
750
759
1038
595
664
186
407
1036
799
847
538
131
133
582
628
369
394
432
906
727
1162
73
125
1125
988
1105
323
152
1178
961
938
642
1115
556
1064
182
607
22
619
586
1076
1129
7
858
942
837
1206
986
1012
399
589
411
862
...

result:

ok passed (165 test cases)

Test #50:

score: 40
Accepted
time: 9ms
memory: 3776kb

input:

966 103 937186357

output:

966 103
4 1803
6 1204
3 1257
1 1019
2 229
1 14
3 260
1 253
1 1467
12 1427
3 675
1 1246
1 1148
5 759
7 607
0 1801
0 41
1 607
4 936
0 1665
3 768
1 115
2 292
0 1478
8 346
1 617
4 7
2 1314
1 1311
5 1825
2 377
0 1556
0 1022
14 937
3 793
1 1362
0 1410
10 1573
11 712
0 674
3 1166
1 1131
2 247
0 1166
2 1777...

input:

966 103
4 1803
6 1204
3 1257
1 1019
2 229
1 14
3 260
1 253
1 1467
12 1427
3 675
1 1246
1 1148
5 759
7 607
0 1801
0 41
1 607
4 936
0 1665
3 768
1 115
2 292
0 1478
8 346
1 617
4 7
2 1314
1 1311
5 1825
2 377
0 1556
0 1022
14 937
3 793
1 1362
0 1410
10 1573
11 712
0 674
3 1166
1 1131
2 247
0 1166
2 1777...

output:

819
1574
1678
1404
920
1929
2
1430
1281
1249
1034
155
934
588
706
1925
1851
1695
843
503
1553
512
1272
1682
1092
405
260
1604
36
672
1081
1216
923
1932
1294
1625
704
1356
1621
1837
62
252
1360
1199
1264
1624
1168
1904
1792
1634
790
1254
296
615
875
1884
432
945
218
1511
313
575
1416
835
1312
1699
12...

result:

ok passed (103 test cases)