QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#415858#8343. 玩游戏marher70 14ms5556kbC++14680b2024-05-21 11:50:542024-05-21 11:50:54

Judging History

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

  • [2024-05-21 11:50:54]
  • 评测
  • 测评结果:70
  • 用时:14ms
  • 内存:5556kb
  • [2024-05-21 11:50:54]
  • 提交

answer

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

ll n,mod,t;

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

std::pair<int, int> encode(vector<int> a)
{
    ll sum=0;
    sort(a.begin(),a.end());
    for(auto x:a)sum=(sum+x)%mod;
    static bool vis[450000];
    for(ll 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)
{
    ll 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: 7ms
memory: 5440kb

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
1000000 1000000
2 10
1 3
0 5
1000000 1000000
1000000 1000000
1000000 1000000
0 8
2 13
1 9
1000000 1000000
6 0
5 3
0 13
1000000 1000000
0 6
13 11
2 10
0 14
6 12
0 3
4 6
8 11
3 14
5 7
1 9
1000000 1000000
0 13
4 6
2 11
9 3
1000000 1000000
1000000 1000000
10 11
4 6
0 1
1000000 1000000
1000000 10...

input:


output:


result:

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

Subtask #2:

score: 30
Accepted

Test #6:

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

input:

68876 1 470211272

output:

68876 1
6 105495
0 96099

input:

68876 1
6 105495
0 96099

output:

73927

result:

ok passed (1 test case)

Test #7:

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

input:

58538 1 101027544

output:

58538 1
5 102795
0 69295

input:

58538 1
5 102795
0 69295

output:

3538

result:

ok passed (1 test case)

Test #8:

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

input:

50603 1 1457850878

output:

50603 1
5 84440
2 91708

input:

50603 1
5 84440
2 91708

output:

76887

result:

ok passed (1 test case)

Test #9:

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

input:

33045 3 1458777923

output:

33045 3
2 52971
0 57210
12 36436
2 275
2 56778
8 60205

input:

33045 3
2 52971
0 57210
12 36436
2 275
2 56778
8 60205

output:

22006
29415
15224

result:

ok passed (3 test cases)

Test #10:

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

input:

20970 4 2007237709

output:

20970 4
1 25605
0 32005
0 6082
2 2431
3 37869
2 11562
3 32894
10 34841

input:

20970 4
1 25605
0 32005
0 6082
2 2431
3 37869
2 11562
3 32894
10 34841

output:

5304
33433
13493
37150

result:

ok passed (4 test cases)

Test #11:

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

input:

40786 2 823564440

output:

40786 2
8 8888
0 48994
2 55569
3 29745

input:

40786 2
8 8888
0 48994
2 55569
3 29745

output:

23711
37058

result:

ok passed (2 test cases)

Test #12:

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

input:

59198 1 1115438165

output:

59198 1
2 87456
5 27626

input:

59198 1
2 87456
5 27626

output:

62531

result:

ok passed (1 test case)

Test #13:

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

input:

92994 1 1784484492

output:

92994 1
6 149322
1 185893

input:

92994 1
6 149322
1 185893

output:

129775

result:

ok passed (1 test case)

Test #14:

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

input:

95914 1 74243042

output:

95914 1
6 127214
2 108303

input:

95914 1
6 127214
2 108303

output:

148161

result:

ok passed (1 test case)

Test #15:

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

input:

56585 1 114807987

output:

56585 1
4 97495
9 48250

input:

56585 1
4 97495
9 48250

output:

24044

result:

ok passed (1 test case)

Test #16:

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

input:

49131 2 1137522503

output:

49131 2
9 84279
4 50135
2 58624
3 16491

input:

49131 2
9 84279
4 50135
2 58624
3 16491

output:

13013
72292

result:

ok passed (2 test cases)

Test #17:

score: 30
Accepted
time: 3ms
memory: 4580kb

input:

58330 1 1441282327

output:

58330 1
2 115851
1 46046

input:

58330 1
2 115851
1 46046

output:

13102

result:

ok passed (1 test case)

Test #18:

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

input:

95899 1 16531729

output:

95899 1
6 90686
0 19169

input:

95899 1
6 90686
0 19169

output:

81959

result:

ok passed (1 test case)

Test #19:

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

input:

59202 1 823378840

output:

59202 1
0 64228
16 110950

input:

59202 1
0 64228
16 110950

output:

61672

result:

ok passed (1 test case)

Test #20:

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

input:

91350 1 143542612

output:

91350 1
0 175208
1 179736

input:

91350 1
0 175208
1 179736

output:

101811

result:

ok passed (1 test case)

Test #21:

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

input:

37397 2 896544303

output:

37397 2
2 32589
1 43710
4 19362
1 32733

input:

37397 2
2 32589
1 43710
4 19362
1 32733

output:

35901
60110

result:

ok passed (2 test cases)

Test #22:

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

input:

51165 1 1474833169

output:

51165 1
2 60151
0 15037

input:

51165 1
2 60151
0 15037

output:

27148

result:

ok passed (1 test case)

Test #23:

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

input:

61423 1 1264817709

output:

61423 1
2 78772
9 46432

input:

61423 1
2 78772
9 46432

output:

59094

result:

ok passed (1 test case)

Test #24:

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

input:

15177 6 1998097157

output:

15177 6
3 20918
8 14891
1 19609
2 12749
1 2297
15 21088
0 3233
3 5207
6 6552
12 26721
10 28253
4 12100

input:

15177 6
3 20918
8 14891
1 19609
2 12749
1 2297
15 21088
0 3233
3 5207
6 6552
12 26721
10 28253
4 12100

output:

9751
13182
7010
6745
27482
20392

result:

ok passed (6 test cases)

Test #25:

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

input:

91469 1 1817129560

output:

91469 1
6 11822
1 78205

input:

91469 1
6 11822
1 78205

output:

1460

result:

ok passed (1 test case)

Test #26:

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

input:

7001 14 1131570933

output:

7001 14
6 6855
1 8171
0 13437
6 11695
0 4697
2 6342
0 2560
3 4653
5 6175
4 7433
5 12672
1 7317
12 2349
1 492
2 547
0 13652
2 10888
11 9314
1 8717
0 2771
5 7718
0 12828
2 4371
0 5592
0 11168
3 6496
1 8816
3 13330

input:

7001 14
6 6855
1 8171
0 13437
6 11695
0 4697
2 6342
0 2560
3 4653
5 6175
4 7433
5 12672
1 7317
12 2349
1 492
2 547
0 13652
2 10888
11 9314
1 8717
0 2771
5 7718
0 12828
2 4371
0 5592
0 11168
3 6496
1 8816
3 13330

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: 12ms
memory: 4292kb

input:

13730 7 197493099

output:

13730 7
1 3257
5 15867
3 22381
0 2572
4 21971
1 15786
0 22701
6 14524
2 18974
1 15315
5 9297
1 15398
0 14084
2 6850

input:

13730 7
1 3257
5 15867
3 22381
0 2572
4 21971
1 15786
0 22701
6 14524
2 18974
1 15315
5 9297
1 15398
0 14084
2 6850

output:

8352
16246
3447
17712
6910
2781
6532

result:

ok passed (7 test cases)

Test #28:

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

input:

5908 16 1404280278

output:

5908 16
1 5443
13 6973
2 8196
6 48
10 6360
0 9311
4 7173
3 6918
0 14
10 1194
1 7788
8 6363
0 1371
2 7584
2 89
0 795
4 6372
0 4390
0 2366
5 5709
4 8093
3 2640
7 982
0 4730
13 5811
4 11147
2 11795
3 1958
1 778
0 4754
0 448
5 4035

input:

5908 16
1 5443
13 6973
2 8196
6 48
10 6360
0 9311
4 7173
3 6918
0 14
10 1194
1 7788
8 6363
0 1371
2 7584
2 89
0 795
4 6372
0 4390
0 2366
5 5709
4 8093
3 2640
7 982
0 4730
13 5811
4 11147
2 11795
3 1958
1 778
0 4754
0 448
5 4035

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: 4352kb

input:

53685 1 893351816

output:

53685 1
0 76996
2 54637

input:

53685 1
0 76996
2 54637

output:

83114

result:

ok passed (1 test case)

Test #30:

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

input:

29258 3 1505795335

output:

29258 3
1 52567
4 54080
5 29529
2 15936
5 1719
4 27869

input:

29258 3
1 52567
4 54080
5 29529
2 15936
5 1719
4 27869

output:

39658
42328
58210

result:

ok passed (3 test cases)

Subtask #3:

score: 40
Accepted

Test #31:

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

input:

18 5555 1954899097

output:

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

input:

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

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: 9ms
memory: 3868kb

input:

995 100 1636807826

output:

995 100
0 1068
3 1659
6 1209
0 237
2 176
1 246
1 35
3 1403
7 1080
1 108
3 1311
0 1341
0 1026
1 1059
8 1303
1 514
0 1286
9 1223
2 107
0 944
0 1258
2 1201
0 294
19 701
3 1158
5 92
1 504
0 825
5 1012
2 1160
0 1043
6 1741
1 1410
6 542
1 1759
0 630
2 1945
5 1044
6 1644
1 556
1 303
0 212
0 519
6 1017
0 11...

input:

995 100
0 1068
3 1659
6 1209
0 237
2 176
1 246
1 35
3 1403
7 1080
1 108
3 1311
0 1341
0 1026
1 1059
8 1303
1 514
0 1286
9 1223
2 107
0 944
0 1258
2 1201
0 294
19 701
3 1158
5 92
1 504
0 825
5 1012
2 1160
0 1043
6 1741
1 1410
6 542
1 1759
0 630
2 1945
5 1044
6 1644
1 556
1 303
0 212
0 519
6 1017
0 11...

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: 9ms
memory: 3908kb

input:

909 110 563613512

output:

909 110
16 226
3 1557
0 1171
10 1132
0 1396
6 838
3 1148
1 915
4 593
0 1401
3 1735
0 1620
3 747
9 1015
1 1232
12 1472
2 813
0 1563
10 589
3 1632
6 693
4 1654
0 818
6 804
6 1106
9 1658
3 1232
1 964
3 249
0 662
0 1788
2 1116
1 572
16 284
0 182
2 689
3 1531
1 1382
6 1813
1 781
1 585
8 184
6 796
0 1281
...

input:

909 110
16 226
3 1557
0 1171
10 1132
0 1396
6 838
3 1148
1 915
4 593
0 1401
3 1735
0 1620
3 747
9 1015
1 1232
12 1472
2 813
0 1563
10 589
3 1632
6 693
4 1654
0 818
6 804
6 1106
9 1658
3 1232
1 964
3 249
0 662
0 1788
2 1116
1 572
16 284
0 182
2 689
3 1531
1 1382
6 1813
1 781
1 585
8 184
6 796
0 1281
...

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: 3904kb

input:

748 133 101929267

output:

748 133
1 656
2 216
1 1128
2 1263
4 464
2 495
4 359
3 176
1 573
3 1332
1 91
2 364
10 71
0 1063
1 1041
13 331
1 56
13 547
4 1212
0 475
3 1212
0 381
0 1082
4 168
4 420
5 1278
2 731
0 1098
13 411
6 900
10 359
5 882
5 1431
2 959
2 811
0 210
3 454
0 525
0 1097
1 405
4 1260
2 1458
0 10
2 324
6 443
7 1494
...

input:

748 133
1 656
2 216
1 1128
2 1263
4 464
2 495
4 359
3 176
1 573
3 1332
1 91
2 364
10 71
0 1063
1 1041
13 331
1 56
13 547
4 1212
0 475
3 1212
0 381
0 1082
4 168
4 420
5 1278
2 731
0 1098
13 411
6 900
10 359
5 882
5 1431
2 959
2 811
0 210
3 454
0 525
0 1097
1 405
4 1260
2 1458
0 10
2 324
6 443
7 1494
...

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: 3840kb

input:

703 142 1580723810

output:

703 142
7 922
0 304
7 131
2 1205
0 1216
5 260
0 298
2 1292
9 1360
0 162
3 1005
1 372
1 603
4 1207
4 361
1 444
1 269
3 1032
3 332
2 1394
0 74
6 1117
6 1360
0 1171
5 1266
2 1207
7 884
4 168
2 762
0 187
11 601
5 1101
15 135
4 374
2 172
0 850
1 1243
6 855
5 239
0 1403
3 1403
13 1054
0 521
2 1128
8 121
0...

input:

703 142
7 922
0 304
7 131
2 1205
0 1216
5 260
0 298
2 1292
9 1360
0 162
3 1005
1 372
1 603
4 1207
4 361
1 444
1 269
3 1032
3 332
2 1394
0 74
6 1117
6 1360
0 1171
5 1266
2 1207
7 884
4 168
2 762
0 187
11 601
5 1101
15 135
4 374
2 172
0 850
1 1243
6 855
5 239
0 1403
3 1403
13 1054
0 521
2 1128
8 121
0...

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: 3888kb

input:

268 373 704877633

output:

268 373
13 134
0 331
2 62
3 186
16 364
0 188
3 89
7 12
2 242
0 417
2 359
9 497
3 496
2 186
1 52
0 481
6 289
3 435
1 152
0 247
1 336
3 197
2 127
11 319
1 304
3 495
13 446
8 373
2 384
3 236
3 22
1 352
2 94
5 367
0 81
1 407
5 345
10 276
0 473
9 298
1 493
3 47
0 44
2 250
3 277
0 422
4 511
1 171
1 390
13...

input:

268 373
13 134
0 331
2 62
3 186
16 364
0 188
3 89
7 12
2 242
0 417
2 359
9 497
3 496
2 186
1 52
0 481
6 289
3 435
1 152
0 247
1 336
3 197
2 127
11 319
1 304
3 495
13 446
8 373
2 384
3 236
3 22
1 352
2 94
5 367
0 81
1 407
5 345
10 276
0 473
9 298
1 493
3 47
0 44
2 250
3 277
0 422
4 511
1 171
1 390
13...

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: 3936kb

input:

171 584 1358580979

output:

171 584
1 150
0 269
3 338
2 23
1 242
0 10
5 251
9 187
4 190
5 124
0 73
1 227
12 42
6 313
3 90
2 163
0 273
2 194
19 230
3 293
0 323
10 271
2 304
0 194
0 107
3 300
0 199
1 60
1 230
0 278
8 266
5 154
2 241
0 308
0 286
4 257
3 287
2 163
1 97
12 310
2 300
0 331
2 249
4 162
6 265
3 165
11 203
0 272
9 15
0...

input:

171 584
1 150
0 269
3 338
2 23
1 242
0 10
5 251
9 187
4 190
5 124
0 73
1 227
12 42
6 313
3 90
2 163
0 273
2 194
19 230
3 293
0 323
10 271
2 304
0 194
0 107
3 300
0 199
1 60
1 230
0 278
8 266
5 154
2 241
0 308
0 286
4 257
3 287
2 163
1 97
12 310
2 300
0 331
2 249
4 162
6 265
3 165
11 203
0 272
9 15
0...

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: 7ms
memory: 4176kb

input:

70 1428 1624379149

output:

70 1428
0 83
3 7
8 95
2 53
3 17
0 115
1 47
0 98
0 55
2 113
10 96
1 46
0 38
3 13
13 124
2 62
9 2
0 58
0 59
5 96
20 25
1 58
5 9
0 73
2 20
4 70
4 113
8 78
0 138
2 72
0 93
1 29
0 26
2 25
1 108
2 48
6 14
5 36
6 115
3 46
2 9
0 118
2 67
7 1
0 58
2 61
4 60
1 17
12 93
1 137
3 30
14 5
0 62
1 3
13 122
3 14
3 3...

input:

70 1428
0 83
3 7
8 95
2 53
3 17
0 115
1 47
0 98
0 55
2 113
10 96
1 46
0 38
3 13
13 124
2 62
9 2
0 58
0 59
5 96
20 25
1 58
5 9
0 73
2 20
4 70
4 113
8 78
0 138
2 72
0 93
1 29
0 26
2 25
1 108
2 48
6 14
5 36
6 115
3 46
2 9
0 118
2 67
7 1
0 58
2 61
4 60
1 17
12 93
1 137
3 30
14 5
0 62
1 3
13 122
3 14
3 3...

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: 9ms
memory: 3924kb

input:

950 105 2128236579

output:

950 105
2 1361
6 891
0 464
1 666
6 279
1 368
0 50
10 157
1 1857
5 1080
6 1828
0 1378
0 652
5 522
6 949
4 388
6 124
14 550
4 1583
0 206
1 1739
4 331
3 120
0 315
0 478
6 1692
10 969
0 827
6 1840
8 1414
1 69
5 447
4 1650
0 1482
12 995
4 93
1 620
0 1696
0 638
4 1297
10 461
5 1756
2 978
0 1863
0 1710
1 1...

input:

950 105
2 1361
6 891
0 464
1 666
6 279
1 368
0 50
10 157
1 1857
5 1080
6 1828
0 1378
0 652
5 522
6 949
4 388
6 124
14 550
4 1583
0 206
1 1739
4 331
3 120
0 315
0 478
6 1692
10 969
0 827
6 1840
8 1414
1 69
5 447
4 1650
0 1482
12 995
4 93
1 620
0 1696
0 638
4 1297
10 461
5 1756
2 978
0 1863
0 1710
1 1...

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: 9ms
memory: 4044kb

input:

780 128 784558821

output:

780 128
2 1136
0 568
4 542
0 276
1 571
2 791
1 457
2 1406
1 1246
0 1462
1 819
17 1069
7 566
1 1436
12 1139
0 369
2 336
0 1216
0 1442
3 1389
1 990
0 952
1 713
2 67
0 17
20 1339
9 530
1 968
2 174
3 703
4 978
6 365
1 1412
4 1190
2 504
0 1518
2 621
6 1019
3 1206
2 927
0 362
3 368
2 513
0 1205
2 192
6 14...

input:

780 128
2 1136
0 568
4 542
0 276
1 571
2 791
1 457
2 1406
1 1246
0 1462
1 819
17 1069
7 566
1 1436
12 1139
0 369
2 336
0 1216
0 1442
3 1389
1 990
0 952
1 713
2 67
0 17
20 1339
9 530
1 968
2 174
3 703
4 978
6 365
1 1412
4 1190
2 504
0 1518
2 621
6 1019
3 1206
2 927
0 362
3 368
2 513
0 1205
2 192
6 14...

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: 9ms
memory: 3840kb

input:

489 204 530511967

output:

489 204
1 256
3 124
4 732
2 753
6 310
0 17
4 200
2 777
7 883
0 945
6 333
0 319
3 152
2 312
0 530
2 409
2 593
4 764
5 439
0 265
7 92
1 922
0 526
6 277
2 353
4 798
0 329
3 558
4 363
1 748
8 839
5 26
2 260
9 75
6 93
4 204
0 370
1 187
2 940
1 812
7 709
2 412
0 590
7 696
0 632
1 582
0 474
2 541
8 537
2 2...

input:

489 204
1 256
3 124
4 732
2 753
6 310
0 17
4 200
2 777
7 883
0 945
6 333
0 319
3 152
2 312
0 530
2 409
2 593
4 764
5 439
0 265
7 92
1 922
0 526
6 277
2 353
4 798
0 329
3 558
4 363
1 748
8 839
5 26
2 260
9 75
6 93
4 204
0 370
1 187
2 940
1 812
7 709
2 412
0 590
7 696
0 632
1 582
0 474
2 541
8 537
2 2...

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: 3856kb

input:

879 113 2110010672

output:

879 113
2 109
9 225
5 1142
3 1528
0 959
5 27
3 179
1 1191
11 318
1 943
0 192
5 431
2 1439
1 1380
7 1141
2 1211
3 1525
1 526
4 1145
0 112
1 576
5 901
0 586
7 380
0 1583
4 1101
0 1723
13 980
11 605
7 645
0 164
9 260
0 1669
2 252
2 141
0 1237
0 1298
1 116
6 1607
12 659
1 342
0 485
4 225
1 1017
0 937
1 ...

input:

879 113
2 109
9 225
5 1142
3 1528
0 959
5 27
3 179
1 1191
11 318
1 943
0 192
5 431
2 1439
1 1380
7 1141
2 1211
3 1525
1 526
4 1145
0 112
1 576
5 901
0 586
7 380
0 1583
4 1101
0 1723
13 980
11 605
7 645
0 164
9 260
0 1669
2 252
2 141
0 1237
0 1298
1 116
6 1607
12 659
1 342
0 485
4 225
1 1017
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: 9ms
memory: 3940kb

input:

520 192 1551901393

output:

520 192
2 1019
0 678
2 297
3 244
2 111
3 471
1 549
2 219
2 462
0 38
1 176
0 1003
0 1018
8 12
2 61
1 1038
3 303
6 646
0 947
11 271
11 396
4 478
1 25
3 507
1 149
15 843
2 71
3 884
3 225
0 261
2 28
1 459
2 639
0 371
0 1017
5 337
0 348
3 114
2 225
5 674
0 251
1 447
0 210
7 719
2 688
0 236
3 673
0 675
2 ...

input:

520 192
2 1019
0 678
2 297
3 244
2 111
3 471
1 549
2 219
2 462
0 38
1 176
0 1003
0 1018
8 12
2 61
1 1038
3 303
6 646
0 947
11 271
11 396
4 478
1 25
3 507
1 149
15 843
2 71
3 884
3 225
0 261
2 28
1 459
2 639
0 371
0 1017
5 337
0 348
3 114
2 225
5 674
0 251
1 447
0 210
7 719
2 688
0 236
3 673
0 675
2 ...

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: 3880kb

input:

647 154 1617819336

output:

647 154
0 1294
5 530
2 577
5 1252
4 941
0 9
1 325
3 649
0 486
7 1093
7 192
0 876
2 351
3 382
5 327
1 864
3 256
10 787
13 268
1 717
3 724
0 736
0 1212
2 5
1 754
13 1109
1 685
2 603
7 1211
0 512
1 547
0 797
0 1127
5 634
22 1171
0 255
3 1175
2 1124
2 1120
9 1004
0 918
1 930
13 772
0 14
6 941
0 1007
0 1...

input:

647 154
0 1294
5 530
2 577
5 1252
4 941
0 9
1 325
3 649
0 486
7 1093
7 192
0 876
2 351
3 382
5 327
1 864
3 256
10 787
13 268
1 717
3 724
0 736
0 1212
2 5
1 754
13 1109
1 685
2 603
7 1211
0 512
1 547
0 797
0 1127
5 634
22 1171
0 255
3 1175
2 1124
2 1120
9 1004
0 918
1 930
13 772
0 14
6 941
0 1007
0 1...

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: 8ms
memory: 3840kb

input:

327 305 1399125485

output:

327 305
1 169
4 187
5 145
1 83
0 171
3 440
0 301
15 71
0 597
1 484
11 182
0 306
8 604
0 345
0 570
3 151
8 129
0 300
0 431
6 192
3 458
2 19
2 415
1 646
1 315
3 426
0 28
5 25
0 436
1 85
5 563
6 570
0 74
1 457
2 622
0 552
7 101
0 391
3 129
6 497
0 412
1 38
3 335
1 381
0 49
1 237
0 262
3 567
12 366
4 16...

input:

327 305
1 169
4 187
5 145
1 83
0 171
3 440
0 301
15 71
0 597
1 484
11 182
0 306
8 604
0 345
0 570
3 151
8 129
0 300
0 431
6 192
3 458
2 19
2 415
1 646
1 315
3 426
0 28
5 25
0 436
1 85
5 563
6 570
0 74
1 457
2 622
0 552
7 101
0 391
3 129
6 497
0 412
1 38
3 335
1 381
0 49
1 237
0 262
3 567
12 366
4 16...

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: 3972kb

input:

595 168 156091745

output:

595 168
0 122
5 287
1 872
0 1173
2 44
0 1081
5 1020
12 677
0 138
1 214
0 814
5 92
1 129
10 782
1 1064
3 1058
3 236
0 237
2 190
4 436
2 952
0 1122
1 1085
5 788
2 780
1 226
1 807
11 1156
10 19
0 1164
6 1108
0 1040
10 930
6 200
3 922
2 1131
0 406
1 426
10 667
7 252
0 53
2 1042
6 973
1 1134
0 466
9 1176...

input:

595 168
0 122
5 287
1 872
0 1173
2 44
0 1081
5 1020
12 677
0 138
1 214
0 814
5 92
1 129
10 782
1 1064
3 1058
3 236
0 237
2 190
4 436
2 952
0 1122
1 1085
5 788
2 780
1 226
1 807
11 1156
10 19
0 1164
6 1108
0 1040
10 930
6 200
3 922
2 1131
0 406
1 426
10 667
7 252
0 53
2 1042
6 973
1 1134
0 466
9 1176...

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: 3860kb

input:

676 147 1356425228

output:

676 147
2 233
10 1038
0 139
9 294
16 319
0 675
0 654
3 769
2 1269
0 184
1 308
3 255
4 654
8 870
6 78
5 865
1 967
6 414
6 1068
2 607
5 1166
2 1224
0 279
2 515
0 681
4 777
0 1314
12 714
1 1033
2 122
8 765
4 1309
1 182
5 942
4 656
1 583
0 726
10 913
5 57
18 55
4 633
0 398
4 342
2 1009
7 1177
2 858
0 87...

input:

676 147
2 233
10 1038
0 139
9 294
16 319
0 675
0 654
3 769
2 1269
0 184
1 308
3 255
4 654
8 870
6 78
5 865
1 967
6 414
6 1068
2 607
5 1166
2 1224
0 279
2 515
0 681
4 777
0 1314
12 714
1 1033
2 122
8 765
4 1309
1 182
5 942
4 656
1 583
0 726
10 913
5 57
18 55
4 633
0 398
4 342
2 1009
7 1177
2 858
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: 3888kb

input:

152 657 1899894091

output:

152 657
2 81
0 71
0 234
1 210
0 181
1 149
3 51
1 254
3 21
1 252
2 124
4 100
3 303
1 198
0 59
13 35
0 250
2 105
8 50
6 182
0 138
9 12
2 197
1 62
0 248
1 150
3 266
0 20
5 121
0 48
2 195
1 87
0 13
1 121
2 205
7 233
0 199
15 159
6 207
0 64
3 99
1 122
1 248
0 6
5 160
10 279
2 74
0 47
2 61
0 243
2 213
5 6...

input:

152 657
2 81
0 71
0 234
1 210
0 181
1 149
3 51
1 254
3 21
1 252
2 124
4 100
3 303
1 198
0 59
13 35
0 250
2 105
8 50
6 182
0 138
9 12
2 197
1 62
0 248
1 150
3 266
0 20
5 121
0 48
2 195
1 87
0 13
1 121
2 205
7 233
0 199
15 159
6 207
0 64
3 99
1 122
1 248
0 6
5 160
10 279
2 74
0 47
2 61
0 243
2 213
5 6...

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: 3900kb

input:

603 165 585640194

output:

603 165
0 206
6 377
18 906
1 495
1 1189
0 395
7 1063
4 920
0 689
1 865
0 1091
7 494
0 425
4 1103
14 1065
0 1188
0 1205
5 109
0 851
2 217
3 449
0 61
1 1075
3 546
2 435
0 410
1 1013
3 925
2 1191
1 900
3 1140
1 829
0 834
1 578
1 775
7 442
0 696
2 1053
3 336
4 185
0 817
13 276
0 735
1 319
3 1203
0 784
0...

input:

603 165
0 206
6 377
18 906
1 495
1 1189
0 395
7 1063
4 920
0 689
1 865
0 1091
7 494
0 425
4 1103
14 1065
0 1188
0 1205
5 109
0 851
2 217
3 449
0 61
1 1075
3 546
2 435
0 410
1 1013
3 925
2 1191
1 900
3 1140
1 829
0 834
1 578
1 775
7 442
0 696
2 1053
3 336
4 185
0 817
13 276
0 735
1 319
3 1203
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: 3824kb

input:

966 103 937186357

output:

966 103
9 875
1 264
3 310
1 59
3 1211
10 43
3 1246
1 1226
2 1476
12 1505
3 1661
1 286
1 188
4 789
6 650
0 1801
0 41
1 1580
2 957
0 1665
4 790
2 124
14 335
0 1478
3 1352
1 1590
3 997
1 358
1 351
3 886
1 1354
0 1556
0 1022
6 1008
3 1779
10 1391
0 1410
8 1633
3 1730
0 674
13 244
2 1140
2 260
0 1166
1 8...

input:

966 103
9 875
1 264
3 310
1 59
3 1211
10 43
3 1246
1 1226
2 1476
12 1505
3 1661
1 286
1 188
4 789
6 650
0 1801
0 41
1 1580
2 957
0 1665
4 790
2 124
14 335
0 1478
3 1352
1 1590
3 997
1 358
1 351
3 886
1 1354
0 1556
0 1022
6 1008
3 1779
10 1391
0 1410
8 1633
3 1730
0 674
13 244
2 1140
2 260
0 1166
1 8...

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)