QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#374817#3056. Live ProgrammingSolitaryDream#AC ✓364ms129684kbC++171.4kb2024-04-02 18:37:302024-04-02 18:37:30

Judging History

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

  • [2024-04-02 18:37:30]
  • 评测
  • 测评结果:AC
  • 用时:364ms
  • 内存:129684kb
  • [2024-04-02 18:37:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 4010;
int n, T, t[N], p[N], d[N];
int f[N][N];
inline void UpdMax(int &x, int y) {
    x = max(x, y);
}
inline int Sqr(int x) {
    return x * x;
}
inline void Solve(int i, int pl, int pr, int chol, int chor) {
    int pm = (pl + pr) >> 1;
    int cho = chol, bst = -1e15;
    for (int j = chol; j <= chor && j < pm; ++j) {
        int nval = f[i][j] + p[pm] - Sqr(d[j] - d[pm]);
        if (nval > bst) bst = nval, cho = j;
    }
    if (i + t[pm] <= T) UpdMax(f[i + t[pm]][pm], bst);
    if (pl < pm) Solve(i, pl, pm - 1, chol, cho);
    if (pm < pr) Solve(i, pm + 1, pr, cho, chor);
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> T;
    vector<tuple<int, int, int>> vec;
    for (int i = 1, x, y, z; i <= n; ++i) {
        cin >> x >> y >> z;
        vec.push_back({z, x, y});
    }
    sort(vec.begin(), vec.end());
    for (int i = 1; i <= n; ++i) {
        auto [z, x, y] = vec[i - 1];
        t[i] = x; p[i] = y; d[i] = z;
    }
    memset(f, -1, sizeof f);
    for (int i = 0; i <= T; ++i) {
        for (int j = 1; j <= n; ++j) if (i >= t[j]) UpdMax(f[i][j], p[j]);
        Solve(i, 1, n, 1, n);
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) ans = max(ans, f[T][i]);
    cout << ans << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 129260kb

input:

2 10
10 200 1
10 100 100

output:

200

result:

ok single line: '200'

Test #2:

score: 0
Accepted
time: 7ms
memory: 129480kb

input:

3 15
5 100 1
5 100 2
5 100 4

output:

295

result:

ok single line: '295'

Test #3:

score: 0
Accepted
time: 12ms
memory: 129172kb

input:

3 10
5 200 200
5 200 201
5 300 1

output:

399

result:

ok single line: '399'

Test #4:

score: 0
Accepted
time: 7ms
memory: 129224kb

input:

3 20
5 100 200
5 100 201
5 300 1

output:

300

result:

ok single line: '300'

Test #5:

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

input:

5 61
14 49 7
31 46 4
30 55 5
52 99 1
34 70 3

output:

103

result:

ok single line: '103'

Test #6:

score: 0
Accepted
time: 0ms
memory: 129224kb

input:

42 16
16 72073499 4632
1 18467047 9046
14 31273517 3525
3 43577541 4655
1 31950136 410
3 35007694 5797
9 49328891 4854
2 74367508 7864
7 51170926 6563
4 77856895 784
1 78297498 3393
16 77127326 8501
16 71424103 6731
4 61491251 9925
3 76313409 4018
4 59712678 2624
5 43021655 9439
10 14064673 6791
4 1...

output:

448259665

result:

ok single line: '448259665'

Test #7:

score: 0
Accepted
time: 3ms
memory: 129416kb

input:

64 17
13 23916157 888
1 22334161 8106
5 64756275 9683
11 30753510 5644
7 94891777 3978
12 55980188 427
6 6540494 6728
3 98108147 3243
4 97266872 5008
2 67036662 869
7 10060360 9008
16 54165933 2716
14 2836966 6200
11 95955330 8715
8 78063765 6641
1 70178421 9095
17 88168595 861
5 32864912 497
11 176...

output:

579504064

result:

ok single line: '579504064'

Test #8:

score: 0
Accepted
time: 4ms
memory: 129228kb

input:

46 16
14 81598337 3552
11 88196612 3612
6 19284768 8025
15 94746496 640
10 38944210 9658
9 83707521 8401
12 74473205 2793
7 95611173 5014
7 32689034 6079
4 85474165 3828
4 32475219 3333
10 86932984 8988
10 84739464 202
5 33650562 3173
16 83135736 2238
3 42763804 861
7 33345463 3510
4 80045035 8420
1...

output:

485842176

result:

ok single line: '485842176'

Test #9:

score: 0
Accepted
time: 4ms
memory: 129140kb

input:

83 18
5 26109671 5229
9 5869134 8624
17 68285176 5334
17 25966106 9778
10 99012646 6103
8 36881819 350
6 68916818 4268
5 12416787 2059
12 33926135 8430
13 53053393 28
16 37917483 3939
13 69640803 8622
8 58733914 5754
12 45812390 1939
11 28539882 6776
3 22976416 1198
13 57192555 4131
7 49897524 2425
...

output:

531995609

result:

ok single line: '531995609'

Test #10:

score: 0
Accepted
time: 3ms
memory: 129192kb

input:

27 15
5 77446548 5081
10 44320822 7153
6 84527050 9258
7 21481696 5028
13 30193873 4597
15 60993463 505
9 50705149 1269
14 60112392 9949
15 37189654 5763
11 28439956 8197
5 41786770 6315
1 11584464 1052
14 70218645 3449
5 60451409 8298
10 71696550 2703
5 26454699 8541
5 70627710 9987
14 66906649 826...

output:

239424098

result:

ok single line: '239424098'

Test #11:

score: 0
Accepted
time: 7ms
memory: 129468kb

input:

79 16
12 37122590 8434
16 36047757 3933
6 92059912 1419
13 88871914 7686
14 57455124 4481
11 48623936 7290
4 88768842 4194
8 7423394 2638
16 46806688 8799
10 63145519 6442
4 17430787 3219
5 40769755 9071
13 26919811 5465
9 91749043 7660
13 16216543 9099
6 81862394 474
8 39107921 7219
15 28979566 800...

output:

519730524

result:

ok single line: '519730524'

Test #12:

score: 0
Accepted
time: 0ms
memory: 129188kb

input:

48 12
2 4646818 666
3 88260305 8335
8 59021859 6524
6 35794089 3133
7 94155606 4497
4 81614809 2095
9 64147226 4085
7 69078705 6681
12 17700055 5282
3 24315032 4590
2 69975114 818
10 59495399 1905
4 65190135 6105
5 21551800 946
3 27596797 2663
6 10757603 7745
5 258958 8215
1 74731249 8172
7 46639577...

output:

520273468

result:

ok single line: '520273468'

Test #13:

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

input:

75 13
7 94331647 6193
13 80404992 7
8 66203187 199
2 85139526 3649
7 20011372 5657
10 26593330 6819
2 84322268 9858
5 26098094 3039
10 65390456 9232
1 54845879 1406
3 50242479 5693
11 47678893 1254
11 72624601 6191
2 95744917 2705
9 64216241 1633
10 3391876 9531
10 57800618 196
2 69415076 9220
1 800...

output:

659466995

result:

ok single line: '659466995'

Test #14:

score: 0
Accepted
time: 0ms
memory: 129172kb

input:

76 14
7 35720038 6189
7 95147273 7448
2 66389185 2399
14 91945044 9925
9 95763495 7400
9 59066766 8511
8 58533280 4785
8 98657793 6785
3 48637340 6118
2 44011086 565
6 37267686 9429
7 64214239 3355
3 29549884 9361
11 86549276 9162
12 42712794 2273
5 40439365 4775
14 1504459 4199
10 62357906 6461
11 ...

output:

395962320

result:

ok single line: '395962320'

Test #15:

score: 0
Accepted
time: 3ms
memory: 129236kb

input:

59 13
4 26703215 7701
6 64093157 9927
8 1190305 6862
3 27259567 1263
5 87320488 4726
5 8514068 5928
12 41959224 9674
13 47118837 2277
13 71316772 34
3 64744216 5802
10 39623039 8418
11 33619746 2729
1 17573922 1329
2 60255675 9802
5 9231818 6421
4 59481829 3360
13 12077561 7829
4 7146913 7203
8 5915...

output:

443826668

result:

ok single line: '443826668'

Test #16:

score: 0
Accepted
time: 16ms
memory: 129436kb

input:

2171 66
37 62090351 8571
29 49788882 7156
9 74127468 6410
3 14494975 9234
18 98069986 7486
14 69153326 5436
66 89664863 361
25 92260063 3807
9 94370348 890
59 10712232 9445
55 33302118 7245
12 20133542 8125
51 90598109 9513
46 47205380 9746
15 91687141 258
19 45001071 7916
37 13141333 439
3 95698563...

output:

3069887407

result:

ok single line: '3069887407'

Test #17:

score: 0
Accepted
time: 7ms
memory: 129448kb

input:

230 95
59 98077375 2637
55 24308109 398
68 94671272 5440
83 18283437 5567
90 19837292 8317
22 92988658 1356
65 7437553 8707
20 79844602 258
7 22700323 9207
21 4888168 8575
64 45370766 9677
88 76403031 3237
10 76978021 2849
19 28902853 3092
39 89957851 1108
85 22553300 8929
85 88067846 1384
70 319421...

output:

1111820191

result:

ok single line: '1111820191'

Test #18:

score: 0
Accepted
time: 3ms
memory: 129240kb

input:

680 85
53 89158567 3459
71 80387994 350
51 87597680 7952
68 26528530 6147
39 86996350 7180
71 49213920 381
18 11870254 7512
30 54350516 3510
9 18866093 3534
18 15151887 7214
33 23154858 2296
79 26738236 6590
28 75440983 6973
22 70905626 1783
13 29502014 9158
36 24405664 2363
83 70656488 7946
70 7530...

output:

1755969453

result:

ok single line: '1755969453'

Test #19:

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

input:

2869 100
81 13249001 7904
8 8756771 9537
80 98675312 4569
96 87009805 5013
45 17182915 5574
44 85245277 549
88 14335813 6949
87 9136510 2857
58 74684646 4408
48 74073403 5791
68 13863136 3435
9 16690209 2826
40 82002010 5920
29 24345507 2931
51 15640753 5452
15 46175164 6872
18 41456782 5369
97 2642...

output:

3612877304

result:

ok single line: '3612877304'

Test #20:

score: 0
Accepted
time: 0ms
memory: 129284kb

input:

1955 52
39 71385387 4311
23 21513691 2327
35 15641077 9998
14 69816765 8790
51 18808298 7362
34 56057220 3233
50 71455725 4916
47 671915 9044
36 80338862 218
51 22054578 4566
18 7721117 9705
10 12261373 6305
32 85783232 4190
41 35706003 1013
24 21277413 789
46 55952583 4861
7 80914240 7824
10 314640...

output:

3064637911

result:

ok single line: '3064637911'

Test #21:

score: 0
Accepted
time: 3ms
memory: 129140kb

input:

96 70
56 77970493 1909
64 39378164 3088
22 91698700 834
32 37401854 9962
65 71462640 5539
69 41275507 8733
16 65143324 4601
48 41667300 3203
17 13641272 1269
15 26547760 3769
30 86175412 6459
1 95393882 6693
16 62213284 2789
44 39446616 7424
63 94515470 1285
37 29350609 2742
63 85825043 3115
55 9182...

output:

1033436938

result:

ok single line: '1033436938'

Test #22:

score: 0
Accepted
time: 15ms
memory: 129412kb

input:

2858 93
49 85188876 6051
40 64409859 5696
75 3692752 8859
64 78831517 2414
85 33194652 5549
46 77606999 5093
16 66094028 5302
11 62602985 2921
29 9968604 6847
66 71134643 8824
72 50212492 5516
34 79009854 5792
20 8543950 1161
28 72850152 7977
11 37032176 1423
77 31061542 6246
57 47694101 6312
38 190...

output:

3498452387

result:

ok single line: '3498452387'

Test #23:

score: 0
Accepted
time: 7ms
memory: 129684kb

input:

2887 75
59 73832369 3834
7 56079343 1107
25 35821237 5531
47 4026696 1141
47 68177147 4084
33 47826502 6863
46 63257569 335
48 52734840 7261
18 55574594 399
23 93530549 4302
7 39937588 4834
25 7535855 2150
41 1144238 3150
25 18650633 5055
44 49364185 2416
17 90441152 942
48 64970375 5794
65 92247042...

output:

3547995405

result:

ok single line: '3547995405'

Test #24:

score: 0
Accepted
time: 12ms
memory: 129376kb

input:

3846 85
66 52931980 6742
39 10324323 5341
4 47853964 3820
73 94591413 9028
2 80055836 6197
71 83167938 44
64 19171670 21
69 98537507 4267
8 98452293 7599
35 29390251 6405
2 27662236 2443
38 42072268 2793
53 87721516 3046
54 15868002 3477
65 15236455 2335
55 61884292 1815
75 8233820 7914
51 42439747 ...

output:

4233082423

result:

ok single line: '4233082423'

Test #25:

score: 0
Accepted
time: 7ms
memory: 129424kb

input:

3446 63
13 57597409 3609
15 28641508 3281
15 46943561 5520
7 79748221 7072
39 47554436 5735
16 82720331 8308
44 7036101 4911
20 20901597 1268
58 72169673 3540
19 97819394 1762
15 74333907 539
18 94401479 5833
18 21744610 4422
35 13241835 5998
45 67176386 8535
3 27194993 4657
19 39067997 5570
34 4787...

output:

3422180138

result:

ok single line: '3422180138'

Test #26:

score: 0
Accepted
time: 4ms
memory: 129652kb

input:

2326 62
38 49771898 9218
28 39727440 2211
5 13968890 2003
5 12960371 7344
10 82118439 3010
20 78067627 3873
51 64313016 47
12 53604214 5959
20 61283029 3432
56 12541788 9716
1 90324851 5705
3 65144872 2734
47 8937317 3024
51 75887615 8114
22 84097958 8433
24 28776454 6672
56 8758218 3599
3 73408846 ...

output:

3265808392

result:

ok single line: '3265808392'

Test #27:

score: 0
Accepted
time: 4ms
memory: 129236kb

input:

89 61
28 44769574 3523
49 96052572 7907
17 26348104 8097
24 87599119 4953
37 61089048 3778
33 11778317 7437
55 11875902 3806
21 4011189 4501
15 92008699 2883
18 59283489 4117
23 28641551 1297
49 55102423 6247
26 4166947 6768
23 52415278 2529
2 68384978 2785
58 69732023 4939
28 18267049 3729
45 10630...

output:

767257782

result:

ok single line: '767257782'

Test #28:

score: 0
Accepted
time: 11ms
memory: 129200kb

input:

57 96
96 99999168 2134
18 18749808 2133
5 5208280 2132
96 99999072 2131
5 5208295 2135
19 19791483 2135
10 10416590 2132
19 19791483 2132
10 10416580 2133
9 9374922 2132
15 15624870 2132
12 12499884 2133
9 9374922 2132
14 14583198 2130
8 8333256 2133
17 17708152 2134
12 12499872 2135
9 9374922 2133
...

output:

99999258

result:

ok single line: '99999258'

Test #29:

score: 0
Accepted
time: 4ms
memory: 129404kb

input:

14 86
57 19978543 6291
21 37695840 9349
18 82104606 9128
51 85520188 1185
2 1872548 6031
14 19322015 2317
43 41597790 342
10 29886456 1533
23 1138900 6399
15 89092004 9273
8 86014743 7583
51 98913282 4251
51 48814719 1337
15 47765799 8728

output:

341175166

result:

ok single line: '341175166'

Test #30:

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

input:

3 60
7 64 2
38 39 2
44 66 9

output:

103

result:

ok single line: '103'

Test #31:

score: 0
Accepted
time: 7ms
memory: 129460kb

input:

4 80
46 35 4
25 2 9
54 4 10
56 96 5

output:

96

result:

ok single line: '96'

Test #32:

score: 0
Accepted
time: 3ms
memory: 129424kb

input:

10 87
30 60 3
21 66 10
23 86 10
58 90 4
66 23 7
25 83 1
46 41 5
40 97 1
67 51 1
57 88 5

output:

180

result:

ok single line: '180'

Test #33:

score: 0
Accepted
time: 0ms
memory: 129428kb

input:

2 71
41 57 4
26 9 4

output:

66

result:

ok single line: '66'

Test #34:

score: 0
Accepted
time: 4ms
memory: 129232kb

input:

9 61
14 49 7
32 21 2
31 42 4
31 16 3
30 11 5
52 26 1
34 70 3
35 29 4
33 4 7

output:

103

result:

ok single line: '103'

Test #35:

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

input:

4 56
4 3 3
25 62 9
2 49 2
36 70 4

output:

120

result:

ok single line: '120'

Test #36:

score: 0
Accepted
time: 0ms
memory: 129252kb

input:

10 70
22 81 1
7 64 5
53 42 10
32 43 6
38 75 7
34 7 4
48 67 1
58 49 8
15 48 5
35 10 8

output:

200

result:

ok single line: '200'

Test #37:

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

input:

6 100
90 4 6
78 56 7
5 48 8
96 6 9
28 31 6
31 89 7

output:

166

result:

ok single line: '166'

Test #38:

score: 0
Accepted
time: 7ms
memory: 129232kb

input:

10 74
9 97 5
32 88 5
65 16 9
25 12 1
13 61 9
18 10 5
35 32 3
10 86 8
15 88 7
55 3 6

output:

354

result:

ok single line: '354'

Test #39:

score: 0
Accepted
time: 3ms
memory: 129484kb

input:

3 80
68 66 4
73 34 5
69 89 3

output:

89

result:

ok single line: '89'

Test #40:

score: 0
Accepted
time: 0ms
memory: 129136kb

input:

24 84
16 30034092 7107
73 3189557 9441
29 10094073 773
14 82619111 975
51 21260517 2499
25 44245206 4448
21 7891496 7551
46 49167686 9523
18 8139884 2748
84 72847690 6067
76 66634 3627
76 84000524 2125
41 58404093 4045
57 93232188 9545
67 8968012 4667
81 16092867 5396
15 40604923 244
34 21530720 525...

output:

278597182

result:

ok single line: '278597182'

Test #41:

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

input:

46 52
14 23055179 3803
11 18472448 6956
38 5574521 953
27 70244164 8376
9 63858289 8320
1 30793252 4465
15 92517516 8152
43 96366406 7058
5 89663198 602
19 89875539 4817
2 32339066 1238
28 44852003 7951
21 43979931 7409
31 3600856 6649
13 40485735 8032
38 8132390 7726
8 69253585 7023
44 18078336 387...

output:

466597182

result:

ok single line: '466597182'

Test #42:

score: 0
Accepted
time: 4ms
memory: 129140kb

input:

24 62
39 25530830 7234
29 77725560 646
13 62998776 107
32 3664926 4223
59 54628015 8229
41 33562259 1978
4 85741995 7704
16 74094394 8805
3 83434164 236
51 97650169 2073
44 73122372 7496
48 20174520 4158
22 97071751 9954
44 22071783 7618
34 29360939 9339
35 80848644 473
13 7965359 870
21 5832 5766
1...

output:

442586896

result:

ok single line: '442586896'

Test #43:

score: 0
Accepted
time: 7ms
memory: 129196kb

input:

78 58
42 50333653 6723
11 49010763 1466
5 24236750 1516
37 44514697 7858
46 21020215 7929
38 51013069 9453
58 27105059 3636
4 63752463 5070
21 14435865 3439
4 3406215 6240
34 76610340 7760
38 41969571 9904
36 16331347 393
57 86606898 296
13 86782306 97
15 53483150 6690
31 58695864 5059
52 42871978 3...

output:

703704141

result:

ok single line: '703704141'

Test #44:

score: 0
Accepted
time: 3ms
memory: 129280kb

input:

52 80
4 5956321 4145
13 72342582 123
6 47674678 4388
78 64927677 1133
54 17452584 4814
10 5910230 7786
78 29904146 2309
21 29429021 8066
23 90312577 5002
29 63129146 8344
22 44962471 8208
22 46573578 6784
42 7247964 6428
27 95401643 2097
22 83218079 3804
18 88433109 9057
40 47180903 1663
76 94764225...

output:

429876623

result:

ok single line: '429876623'

Test #45:

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

input:

30 90
60 86740125 2069
11 94553984 4057
83 83483378 9285
21 41295282 2570
21 98474200 3596
2 92679612 6870
50 5238143 1642
77 37524101 3589
80 25545689 2631
16 89945973 9871
10 9685553 8613
48 98217876 9870
4 39990160 8206
66 70455931 8945
40 19883613 1185
80 3472867 6879
7 58269237 7615
7 59094288 ...

output:

578274634

result:

ok single line: '578274634'

Test #46:

score: 0
Accepted
time: 3ms
memory: 129280kb

input:

77 66
9 49707951 5656
66 59889887 4933
55 82375776 914
16 85988818 129
28 80860301 9553
21 89140357 2128
42 29238539 8912
56 26390322 2545
25 51199763 4403
61 94634649 9028
31 16621279 5362
11 85468907 3119
47 35060643 68
36 81007757 7530
42 19806879 2160
57 5326440 1473
29 92319572 4514
27 97561349...

output:

716549629

result:

ok single line: '716549629'

Test #47:

score: 0
Accepted
time: 3ms
memory: 129232kb

input:

10 78
8 25681446 6098
11 17119818 3307
6 70188894 5616
65 18525571 2628
75 13228987 9439
26 49815551 7344
5 27681552 6676
65 90202702 2479
20 74126802 5888
5 22234888 1375

output:

258384190

result:

ok single line: '258384190'

Test #48:

score: 0
Accepted
time: 0ms
memory: 129444kb

input:

66 87
34 10150649 1290
8 50004354 1876
51 71310131 6055
62 41241163 1383
10 11518784 5173
62 65127251 8585
78 52468736 3086
29 31495918 8935
30 26038037 8353
26 48178107 3862
60 14068627 7385
7 60493980 3038
11 31694084 3080
14 86916923 6206
28 49240668 8907
76 66074351 1709
20 44246417 4934
37 5775...

output:

590690784

result:

ok single line: '590690784'

Test #49:

score: 0
Accepted
time: 3ms
memory: 129228kb

input:

20 82
27 70986455 4139
24 98966877 1376
46 38908405 2926
18 84821085 1239
3 77514809 713
19 31004591 2183
80 49605212 2439
55 73756599 1886
41 47760540 9601
61 42746495 682
36 72187487 9858
52 20132102 1723
16 73506604 9774
76 99230058 6877
40 22231088 7857
47 57254339 8076
66 30054369 5575
33 44136...

output:

324359612

result:

ok single line: '324359612'

Test #50:

score: 0
Accepted
time: 146ms
memory: 129460kb

input:

2315 2473
1115 17887351 6708
1323 46807584 9846
1754 4880424 8595
1934 56955615 3213
107 12558830 5034
2407 79676234 4036
647 512036 6156
1670 15784726 3551
183 79646336 7495
775 12229271 2141
948 92381948 6115
1023 74765653 6615
111 18394878 7783
1443 49642332 1015
683 22481504 6743
590 66299300 94...

output:

3762983535

result:

ok single line: '3762983535'

Test #51:

score: 0
Accepted
time: 131ms
memory: 129384kb

input:

1709 3192
2191 4677235 3560
55 24801417 7020
835 24511911 7423
1011 82409083 1104
987 77237851 2552
710 59965239 4854
77 79559296 2591
2694 22290609 8565
1120 82206071 456
1825 55146141 8480
3070 25852456 2906
1286 12840354 879
2530 64082261 5465
1862 47265420 9755
1149 58549322 3897
1328 8355524 27...

output:

3574731917

result:

ok single line: '3574731917'

Test #52:

score: 0
Accepted
time: 364ms
memory: 129444kb

input:

3716 3867
1189 82367138 5093
2435 22638100 8121
3022 21257866 1134
2214 44981946 5304
1223 62798780 1317
782 55687883 1676
3576 1283483 890
815 74738200 5439
2298 42502800 9579
2309 62373350 1716
2741 85463192 7191
3652 13122247 6102
754 41887381 6173
1652 51147994 8231
2405 486022 677
2728 28582111...

output:

4131096035

result:

ok single line: '4131096035'

Test #53:

score: 0
Accepted
time: 21ms
memory: 129496kb

input:

369 2870
254 66186319 436
1327 83568206 211
2650 39622840 2454
1693 52824036 6963
1480 26547367 6556
517 87153940 8564
2514 40434254 1330
318 80192953 7242
1679 16184875 8260
2058 14472476 2858
1149 93069829 4885
1809 55701111 2295
1454 27966578 4878
2619 36554139 9614
1051 13559227 2721
224 7428832...

output:

1512996596

result:

ok single line: '1512996596'

Test #54:

score: 0
Accepted
time: 236ms
memory: 129468kb

input:

3990 2233
163 15556060 5391
75 13242433 151
127 45999457 4569
1787 41183456 782
1322 91955768 803
654 50620177 9932
1023 75408260 6085
286 12989128 7303
928 4745348 3002
518 72553845 1548
165 77795930 4909
1434 98507213 5845
528 86752426 6190
504 18949201 4847
1395 62057807 1758
2133 25780725 5689
1...

output:

4748838594

result:

ok single line: '4748838594'

Test #55:

score: 0
Accepted
time: 49ms
memory: 129288kb

input:

884 2599
2039 50907716 9181
583 40891788 2546
606 46271629 3852
1248 15103135 3751
1349 12945976 1888
2413 83907664 1130
2204 86998261 1764
1581 82601866 8898
2425 75251755 487
2565 24189604 3641
1720 76027119 5343
2408 10421680 2872
2223 64715068 5162
1770 70202499 7482
662 34897676 4361
176 370779...

output:

2288956802

result:

ok single line: '2288956802'

Test #56:

score: 0
Accepted
time: 274ms
memory: 129664kb

input:

3090 3419
1748 54493011 1352
566 35904775 244
1639 70902467 3806
3198 14193177 8705
1726 75615737 827
1189 37486010 1206
2341 91954964 6749
1973 23167880 3637
909 81998115 4179
2428 83619298 1572
1813 51213052 2677
2478 99388409 5582
628 91654257 7047
865 96496935 43
344 14529771 2085
1851 9403628 7...

output:

4665758734

result:

ok single line: '4665758734'

Test #57:

score: 0
Accepted
time: 15ms
memory: 129204kb

input:

205 3534
1344 19876348 7639
2248 36071979 3446
2301 80293476 2904
389 31245346 6443
2193 21755765 373
674 90575132 937
2567 50963114 8911
2418 74959292 6828
1079 53663191 8017
461 25223419 8888
3435 67577783 7673
1308 9611742 4598
2970 32879465 7995
1821 49892333 6291
1213 59857862 1834
1204 9470214...

output:

1025677069

result:

ok single line: '1025677069'

Test #58:

score: 0
Accepted
time: 83ms
memory: 129244kb

input:

1296 3496
1975 51119330 5286
2675 16709592 6350
297 39539551 4311
1970 54373388 1491
2042 16838780 5333
219 4382266 2602
2605 97775743 7153
3091 80861479 5488
2125 73405782 5855
3444 18766430 1749
798 63817414 8159
460 39461042 8011
174 13783257 9083
3432 39194829 3129
2768 12391538 3246
215 1214899...

output:

3226303232

result:

ok single line: '3226303232'

Test #59:

score: 0
Accepted
time: 109ms
memory: 129460kb

input:

2307 2058
890 10363202 7597
1268 37369682 2643
111 25465748 1590
666 5970491 4814
1304 79068937 6622
1517 9841845 7574
1113 23910064 7864
63 97884289 1294
1104 2531080 7127
20 43090310 366
1592 70544857 8359
1136 22663323 4366
728 72150546 6045
618 71194989 1473
366 27907905 1298
1797 81698944 3492
...

output:

4045737786

result:

ok single line: '4045737786'

Test #60:

score: 0
Accepted
time: 127ms
memory: 129368kb

input:

2466 3155
6 10825456 4856
9 84997740 6582
3 71976038 2452
1 38468037 8773
1 41686540 8309
7 9486821 6750
9 64371989 7432
4 9391519 7583
10 27893639 9958
4 19987967 7541
8 10391048 7573
6 49676973 7360
3 51826503 2489
3 64099933 6009
3 89244690 8398
4 31540086 9592
2 53822113 4073
1 3200768 4561
8 30...

output:

67687395875

result:

ok single line: '67687395875'

Test #61:

score: 0
Accepted
time: 141ms
memory: 129612kb

input:

3105 2128
8 17417817 7109
6 71327920 9595
10 84277536 4531
10 99129800 9062
9 71906561 1168
3 53673841 2755
3 26887181 7175
4 6448252 1516
8 25585045 9122
2 58743236 4025
3 38196991 7142
6 79642684 5502
2 85658477 4673
2 80830345 5778
1 19274397 9098
8 29275598 664
1 15526353 7463
1 14755800 7279
4 ...

output:

56939822360

result:

ok single line: '56939822360'

Test #62:

score: 0
Accepted
time: 306ms
memory: 129404kb

input:

3901 3141
5 15732240 6698
3 54175245 9584
4 13499046 9958
5 97122024 4785
8 71596291 9416
7 21442907 8042
5 45850010 3443
1 59126668 2382
1 65066983 2765
4 75277383 5104
1 68631047 6945
2 18345102 5051
6 39601719 8566
10 59974935 3933
2 66793500 6757
8 86916410 8814
10 61999141 1526
4 32383434 286
2...

output:

80668132965

result:

ok single line: '80668132965'

Test #63:

score: 0
Accepted
time: 341ms
memory: 129496kb

input:

3753 3678
2 32351208 4611
8 2974092 8869
8 36567209 1379
8 50133983 1317
5 30710705 8311
8 61240334 7488
1 98682447 4772
8 73401707 3334
10 3891918 9642
6 75410073 4137
1 8225036 3452
3 12966041 6007
1 52667970 4920
3 94732436 4589
1 26426586 6220
8 58162676 1671
6 55487641 121
9 15610784 8176
4 280...

output:

88354957449

result:

ok single line: '88354957449'

Test #64:

score: 0
Accepted
time: 227ms
memory: 129444kb

input:

3486 2766
3 73738150 2033
4 52136752 7337
5 87063249 6814
4 63342964 4258
7 51141494 5871
8 6857532 5621
8 32744185 855
4 20791424 4132
5 88575709 9735
6 33261582 6123
2 83240648 3997
3 60277359 1043
3 10092806 1796
10 15729441 9598
7 49198107 4690
1 5221514 8456
8 18297254 7419
7 27291165 2532
3 17...

output:

70618035509

result:

ok single line: '70618035509'

Test #65:

score: 0
Accepted
time: 302ms
memory: 129428kb

input:

3505 3606
1 90554782 1503
10 64893971 6523
6 36829089 8861
6 87168992 3799
8 51741582 4845
5 14455811 5973
10 6751561 322
6 88345255 248
3 20255801 5853
1 72062455 3881
9 48603871 8454
8 72344056 1760
3 58167096 8847
9 58957591 8901
7 34451112 3284
8 56294039 2840
7 44514303 4702
10 34700614 2187
2 ...

output:

83819006561

result:

ok single line: '83819006561'

Test #66:

score: 0
Accepted
time: 125ms
memory: 129616kb

input:

2360 3847
4 17361284 1138
8 48113099 5904
2 82982760 8474
3 46512306 4245
3 43644908 1853
7 75344784 9541
5 84763422 1101
2 4591410 8239
5 33869099 146
7 85663856 7161
3 47548295 7827
5 4760378 2864
1 97989635 8768
9 56537835 1129
5 99260671 949
2 41502469 9561
6 2445884 2208
3 51512763 1812
6 56659...

output:

72281836723

result:

ok single line: '72281836723'

Test #67:

score: 0
Accepted
time: 189ms
memory: 129380kb

input:

2797 3923
4 78826843 7850
7 9678026 5746
9 7882200 1489
3 68953722 3273
9 8540879 3801
3 62430058 2772
7 18993862 4479
8 30457846 3208
2 12240302 697
9 19751988 9968
8 97428523 8017
8 71096418 6247
3 89356552 5905
7 31721092 893
5 47905939 6369
7 97560065 8691
8 85554016 5218
3 83322104 2020
4 94415...

output:

79414622337

result:

ok single line: '79414622337'

Test #68:

score: 0
Accepted
time: 100ms
memory: 129404kb

input:

2704 2007
10 26531793 8717
1 5082916 217
3 95968396 1866
2 53346558 5242
1 7607362 9253
10 5150438 3064
9 88331416 9645
10 41583007 6596
2 34319942 3284
7 244219 9282
6 89530850 1941
5 11910524 6049
5 3298450 2314
2 4004377 820
10 80852052 1576
3 19516003 5134
8 99730016 4504
10 83347532 5166
10 205...

output:

53688866424

result:

ok single line: '53688866424'

Test #69:

score: 0
Accepted
time: 102ms
memory: 129416kb

input:

2328 3254
8 48751105 4711
4 74883491 5844
2 38538745 8671
8 34786059 3186
7 42196248 9481
7 82442562 6569
5 74937671 9703
8 86672628 322
10 329036 5786
3 62688290 7732
6 6347863 5090
5 58883823 1612
9 78381420 8010
3 15928921 6857
4 85074550 8459
6 31623041 1460
6 33029019 4909
10 22679708 7746
6 14...

output:

66207208847

result:

ok single line: '66207208847'

Test #70:

score: 0
Accepted
time: 7ms
memory: 129464kb

input:

60 96
25 20008602 9998
25 20007556 9993
25 20000460 9991
25 20005558 9996
25 20000730 9996
25 20002992 9996
25 20009893 10000
25 20000347 9994
25 20006929 9995
25 20002972 9997
25 20002750 9992
25 20006413 9995
25 20004268 9993
25 20006778 9993
25 20005745 9991
25 20002245 9995
25 20009342 9999
25 2...

output:

60028704

result:

ok single line: '60028704'

Test #71:

score: 0
Accepted
time: 7ms
memory: 129480kb

input:

95 78
20 20000998 9993
20 20008156 9991
20 20002627 9996
20 20009780 9992
20 20003246 9991
20 20007084 9995
20 20009774 9997
20 20008012 9997
20 20001703 9990
20 20006078 9996
20 20001069 9990
20 20003045 9998
20 20007815 9998
20 20008785 10000
20 20003548 9998
20 20003972 9997
20 20003429 9993
20 2...

output:

60028924

result:

ok single line: '60028924'

Test #72:

score: 0
Accepted
time: 4ms
memory: 129180kb

input:

88 58
15 20006376 9999
15 20004565 9990
15 20009909 9998
15 20003002 9992
15 20001038 9991
15 20008182 9992
15 20007658 9999
15 20001752 9994
15 20007721 10000
15 20009222 9999
15 20007313 9999
15 20002492 9991
15 20007348 9995
15 20003500 9996
15 20002629 9995
15 20005314 9997
15 20009262 9996
15 2...

output:

60029014

result:

ok single line: '60029014'

Test #73:

score: 0
Accepted
time: 7ms
memory: 129192kb

input:

78 74
19 20003821 9993
19 20006133 9993
19 20001869 9998
19 20005732 9999
19 20007180 9996
19 20004037 9992
19 20001455 9990
19 20001594 9992
19 20008645 9992
19 20001081 9997
19 20008672 9996
19 20000241 9998
19 20000099 9998
19 20006518 9995
19 20009403 9996
19 20001910 9993
19 20005174 9993
19 20...

output:

60028791

result:

ok single line: '60028791'

Test #74:

score: 0
Accepted
time: 4ms
memory: 129176kb

input:

79 89
23 20006497 9991
23 20009205 9998
23 20007150 9990
23 20007695 9995
23 20007184 9996
23 20009704 9999
23 20009780 9992
23 20003509 9993
23 20001007 9996
23 20005510 9997
23 20009548 9996
23 20002088 9995
23 20003851 9991
23 20004445 9998
23 20002247 9999
23 20001848 9990
23 20008930 9996
23 20...

output:

60029007

result:

ok single line: '60029007'

Test #75:

score: 0
Accepted
time: 83ms
memory: 129396kb

input:

2949 2003
501 20009983 9998
501 20004532 9997
501 20002396 9995
501 20008604 9996
501 20008610 9990
501 20006777 10000
501 20009940 9995
501 20002802 9991
501 20004178 9995
501 20003080 9992
501 20001697 9997
501 20006111 9991
501 20000091 9996
501 20004663 9992
501 20001915 9997
501 20006068 9991
5...

output:

60029961

result:

ok single line: '60029961'

Test #76:

score: 0
Accepted
time: 102ms
memory: 129376kb

input:

2275 3740
936 20003029 9999
936 20006744 9992
936 20001688 9990
936 20004940 10000
936 20000920 9992
936 20003685 10000
936 20002778 9998
936 20001451 9993
936 20002360 9993
936 20004511 9994
936 20006822 10000
936 20004014 9990
936 20009557 9991
936 20007532 9994
936 20006166 9997
936 20000923 9995...

output:

60029934

result:

ok single line: '60029934'

Test #77:

score: 0
Accepted
time: 76ms
memory: 129404kb

input:

2189 2811
703 20000796 9990
703 20001065 9995
703 20005732 9996
703 20000848 9998
703 20001214 9995
703 20005593 9996
703 20002734 9998
703 20009360 10000
703 20005012 9993
703 20000793 9990
703 20007150 10000
703 20000667 9995
703 20006142 10000
703 20006158 9990
703 20001942 9996
703 20008257 9997...

output:

60029930

result:

ok single line: '60029930'

Test #78:

score: 0
Accepted
time: 161ms
memory: 129680kb

input:

3630 3025
757 20000181 9999
757 20009942 10000
757 20008289 9991
757 20006335 9990
757 20006070 9997
757 20008900 9998
757 20004766 9994
757 20000468 9990
757 20004201 9998
757 20006225 9995
757 20008655 9990
757 20005762 10000
757 20005679 9993
757 20009274 10000
757 20003352 9998
757 20001591 9999...

output:

60029961

result:

ok single line: '60029961'

Test #79:

score: 0
Accepted
time: 94ms
memory: 129412kb

input:

2378 3323
831 20005511 9994
831 20007465 9996
831 20001648 9991
831 20005648 9995
831 20001455 9992
831 20003211 9995
831 20007325 9990
831 20002778 9996
831 20001929 9990
831 20009868 9992
831 20006663 10000
831 20001299 9992
831 20008826 9994
831 20000405 9995
831 20004345 9994
831 20008676 9994
8...

output:

60029950

result:

ok single line: '60029950'