QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304866#2734. Professional NetworkCamillus25 ✓563ms6544kbC++201.4kb2024-01-14 04:42:162024-01-14 04:42:16

Judging History

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

  • [2024-01-14 04:42:16]
  • 评测
  • 测评结果:25
  • 用时:563ms
  • 内存:6544kb
  • [2024-01-14 04:42:16]
  • 提交

answer

#include <algorithm>
#include <cassert>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
 
const int INF = 1e9 + 5;
const long long LL_INF = (long long) 2e18 + 5;
 
struct voter {
    int M, P;
 
    bool operator<(const voter &other) const {
        return M < other.M;
    }
};
 
int N;
vector<voter> voters;
 
long long evaluate(int buy) {
    int index = 0;
    priority_queue<int> pq;
 
    for (int position = buy; position < N; position++) {
        while (index < N && voters[index].M <= position)
            pq.push(voters[index++].P);
 
        if (pq.empty())
            return LL_INF - buy;
 
        pq.pop();
    }
 
    while (index < N)
        pq.push(voters[index++].P);
 
    long long sum = 0;
 
    while (!pq.empty()) {
        sum += pq.top();
        pq.pop();
    }
 
    return sum;
}
 
void solve_case() {
    cin >> N;
    voters.resize(N);
 
    for (voter &v : voters)
        cin >> v.M >> v.P;
 
    sort(voters.begin(), voters.end());
    int low = 0, high = N;
 
    while (low < high) {
        int mid = (low + high) / 2;
 
        if (evaluate(mid) < evaluate(mid + 1))
            high = mid;
        else
            low = mid + 1;
    }
 
    cout << evaluate(low) << '\n';
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
	solve_case();
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 150ms
memory: 6476kb

input:

200000
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0...

output:

0

result:

ok single line: '0'

Test #2:

score: 0
Accepted
time: 33ms
memory: 3860kb

input:

55848
8787 1
40423 1
4209 1
45140 1
40852 1
4984 1
48967 1
28225 1
8553 1
29753 1
24173 1
12996 1
41846 1
19903 1
42728 1
18675 1
18103 1
45100 1
1689 1
34439 1
4780 1
3489 1
27184 1
5120 1
33927 1
54366 1
36868 1
34457 1
21443 1
2077 1
3841 1
11477 1
14409 1
37845 1
2713 1
2799 1
31291 1
53308 1
49...

output:

161

result:

ok single line: '161'

Test #3:

score: 0
Accepted
time: 37ms
memory: 3792kb

input:

51128
47540 1
26373 1
1854 1
36998 1
19702 1
21805 1
6339 1
1544 1
5966 1
50331 1
10629 1
19621 1
49594 1
14541 1
45771 1
37463 1
18140 1
39362 1
6482 1
45363 1
15806 1
46123 1
37409 1
36864 1
611 1
6918 1
15436 1
27465 1
25213 1
23095 1
33022 1
33715 1
48048 1
4654 1
35761 1
44253 1
31240 1
13642 1...

output:

70

result:

ok single line: '70'

Test #4:

score: 0
Accepted
time: 116ms
memory: 5212kb

input:

170783
44747 1
135609 1
113352 1
58387 1
137333 1
64429 1
7175 1
47166 1
145586 1
14618 1
149711 1
39057 1
55998 1
164149 1
68110 1
127423 1
61467 1
121970 1
17368 1
78335 1
18990 1
98187 1
41220 1
116783 1
48224 1
24608 1
120845 1
70767 1
146973 1
120753 1
123122 1
163330 1
28632 1
23622 1
106070 1...

output:

270

result:

ok single line: '270'

Test #5:

score: 0
Accepted
time: 45ms
memory: 4188kb

input:

66865
60318 1
49137 1
12816 1
49625 1
15410 1
21347 1
63569 1
27218 1
54050 1
51307 1
53570 1
4415 1
33854 1
62207 1
43495 1
18414 1
65651 1
10484 1
3007 1
19140 1
19828 1
65632 1
57577 1
65447 1
10176 1
31495 1
63507 1
30997 1
46550 1
48205 1
18848 1
49538 1
17841 1
31052 1
52146 1
23911 1
51971 1
...

output:

116

result:

ok single line: '116'

Test #6:

score: 0
Accepted
time: 19ms
memory: 3624kb

input:

29828
24608 1
7043 1
7766 1
4137 1
12703 1
14450 1
11287 1
19335 1
17916 1
27603 1
28990 1
3407 1
10602 1
22370 1
25076 1
178 1
18767 1
21309 1
8525 1
360 1
21127 1
15745 1
27308 1
29330 1
25237 1
4847 1
1378 1
4291 1
4307 1
15218 1
6069 1
487 1
29704 1
26279 1
9666 1
21629 1
22287 1
11417 1
822 1
2...

output:

26

result:

ok single line: '26'

Test #7:

score: 0
Accepted
time: 118ms
memory: 5172kb

input:

168118
93498 1
86321 1
14188 1
32790 1
115055 1
44412 1
37530 1
85660 1
113613 1
126419 1
151374 1
142658 1
61013 1
137504 1
93678 1
48203 1
127070 1
49335 1
142436 1
156604 1
124454 1
163945 1
93230 1
156015 1
115075 1
22790 1
66595 1
42094 1
18803 1
8314 1
82281 1
75986 1
160594 1
107559 1
67301 1...

output:

321

result:

ok single line: '321'

Test #8:

score: 0
Accepted
time: 142ms
memory: 5208kb

input:

170861
60502 1
150137 1
124734 1
56205 1
83296 1
49860 1
139506 1
43525 1
39281 1
78434 1
135807 1
59186 1
169643 1
57054 1
87902 1
150880 1
58439 1
104835 1
121734 1
131341 1
111209 1
82864 1
295 1
37507 1
59939 1
3753 1
67129 1
136347 1
99884 1
73530 1
20700 1
41700 1
134765 1
133111 1
22440 1
166...

output:

112

result:

ok single line: '112'

Test #9:

score: 0
Accepted
time: 20ms
memory: 3696kb

input:

34448
17496 1
16403 1
13637 1
32811 1
8133 1
23823 1
24092 1
23336 1
15988 1
4329 1
29185 1
30412 1
29127 1
8914 1
31777 1
24569 1
892 1
5626 1
30874 1
27832 1
17475 1
30296 1
12557 1
18021 1
18489 1
3000 1
260 1
16064 1
4361 1
5342 1
5129 1
11202 1
1194 1
31727 1
25058 1
19730 1
31470 1
2710 1
3274...

output:

176

result:

ok single line: '176'

Test #10:

score: 0
Accepted
time: 71ms
memory: 4376kb

input:

90701
50105 1
37737 1
76000 1
15147 1
49913 1
80397 1
44416 1
75279 1
19401 1
87313 1
88816 1
40457 1
37751 1
23313 1
86289 1
86999 1
21115 1
77874 1
35101 1
66577 1
22561 1
47130 1
5570 1
60516 1
57945 1
66903 1
83194 1
16711 1
4429 1
32939 1
53333 1
75108 1
82155 1
46361 1
67922 1
45929 1
80452 1
...

output:

178

result:

ok single line: '178'

Subtask #2:

score: 4
Accepted

Test #11:

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

input:

1
0 0

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

10
10 10000
10 10000
10 10000
10 10000
10 10000
10 10000
10 10000
10 10000
10 10000
10 10000

output:

100000

result:

ok single line: '100000'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

10
10 0
10 0
10 0
10 0
10 0
10 0
10 0
10 0
10 0
10 0

output:

0

result:

ok single line: '0'

Test #14:

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

input:

10
10 219
9 728
8 425
8 380
7 512
7 617
8 434
9 789
8 74
7 100

output:

2360

result:

ok single line: '2360'

Test #15:

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

input:

10
2 7163
7 7183
9 8179
9 6271
7 6425
7 1502
7 1115
5 6916
3 184
8 6840

output:

15313

result:

ok single line: '15313'

Test #16:

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

input:

10
7 3593
8 2206
9 290
5 1836
10 5899
8 2166
7 6378
10 3962
8 2120
9 684

output:

15121

result:

ok single line: '15121'

Test #17:

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

input:

10
3 3235
10 325
9 806
8 2534
10 3271
10 641
8 192
9 43
8 815
9 2397

output:

6093

result:

ok single line: '6093'

Test #18:

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

input:

10
7 387
7 1461
9 1180
0 1809
9 616
9 605
1 300
7 857
0 620
10 1018

output:

2626

result:

ok single line: '2626'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3472kb

input:

10
6 54
10 4496
6 1946
4 4677
5 3791
8 4101
6 4720
2 3859
10 4381
6 3219

output:

8931

result:

ok single line: '8931'

Test #20:

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

input:

10
7 275
2 2001
8 5315
1 3938
10 530
3 3584
10 4559
7 1934
4 52
9 5043

output:

5364

result:

ok single line: '5364'

Test #21:

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

input:

10
9 1500
0 635
1 1825
4 1934
3 2015
9 332
10 1956
2 1782
9 1283
2 1238

output:

3571

result:

ok single line: '3571'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

5
4 4561
5 3797
4 6708
5 982
1 2333

output:

9340

result:

ok single line: '9340'

Test #23:

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

input:

8
8 1687
2 3319
4 1742
7 2319
4 3378
2 4107
4 316
0 2405

output:

1687

result:

ok single line: '1687'

Test #24:

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

input:

3
0 762
0 1464
0 316

output:

0

result:

ok single line: '0'

Test #25:

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

input:

1
1 1686

output:

1686

result:

ok single line: '1686'

Test #26:

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

input:

8
2 2361
2 3762
6 2726
8 6136
1 2163
0 5565
2 4962
3 400

output:

6136

result:

ok single line: '6136'

Test #27:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

4
4 7471
1 4420
0 5824
4 7662

output:

15133

result:

ok single line: '15133'

Test #28:

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

input:

2
2 4872
0 6634

output:

4872

result:

ok single line: '4872'

Test #29:

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

input:

1
1 1773

output:

1773

result:

ok single line: '1773'

Test #30:

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

input:

1
0 4003

output:

0

result:

ok single line: '0'

Test #31:

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

input:

1
0 0

output:

0

result:

ok single line: '0'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

1
0 0

output:

0

result:

ok single line: '0'

Subtask #3:

score: 7
Accepted

Dependency #2:

100%
Accepted

Test #33:

score: 7
Accepted
time: 1ms
memory: 3564kb

input:

1000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 10000
1000 1000...

output:

10000000

result:

ok single line: '10000000'

Test #34:

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

input:

1000
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1000 0
1...

output:

0

result:

ok single line: '0'

Test #35:

score: 0
Accepted
time: 2ms
memory: 3560kb

input:

1000
977 544
801 52
926 385
778 344
867 379
929 211
964 402
849 583
804 567
836 333
873 210
767 177
955 573
378 39
425 541
548 367
921 245
809 279
962 13
865 131
795 316
980 578
875 53
954 154
386 181
787 106
862 434
900 54
811 259
903 454
791 157
943 204
836 245
882 402
934 517
857 554
958 387
975 ...

output:

125174

result:

ok single line: '125174'

Test #36:

score: 0
Accepted
time: 2ms
memory: 3560kb

input:

1000
885 1410
759 939
313 203
748 3708
943 2471
971 851
753 1512
974 175
876 1432
930 644
798 3901
913 493
893 2373
981 1189
511 3183
995 3438
971 3605
841 3075
93 1309
780 575
832 1572
792 2844
979 2240
821 3785
835 2726
447 1856
909 3452
828 1784
852 742
998 3818
986 312
803 633
798 2846
887 513
7...

output:

830265

result:

ok single line: '830265'

Test #37:

score: 0
Accepted
time: 2ms
memory: 3572kb

input:

1000
969 549
919 1616
781 1055
1000 1041
796 547
887 1692
901 128
835 646
581 450
967 487
939 1669
833 1735
326 1061
922 1411
997 1338
870 822
927 15
975 663
993 67
767 510
867 1585
934 1642
760 1606
927 1033
827 709
773 1196
798 723
770 511
870 170
907 575
793 1760
89 432
235 1473
864 1403
839 317
...

output:

376498

result:

ok single line: '376498'

Test #38:

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

input:

1000
444 1831
865 175
875 3633
810 2571
791 1803
958 2075
877 4115
850 823
802 397
957 1582
906 1035
896 1678
872 594
995 3875
763 3636
853 1562
882 1813
812 700
877 1788
286 1678
793 3863
947 3656
875 2785
856 1020
152 4072
21 3044
354 618
912 444
959 1007
865 625
298 3082
874 3853
967 3164
968 522...

output:

990462

result:

ok single line: '990462'

Test #39:

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

input:

1000
158 894
896 3096
858 2659
890 1138
1000 2081
934 256
502 896
904 2463
962 659
906 2489
985 2190
962 1927
817 1684
882 2631
846 1441
590 2755
915 647
894 568
756 385
908 247
973 1418
308 1888
751 1513
777 2171
783 1628
787 1283
834 46
913 716
895 2086
872 1362
821 58
818 1571
934 2661
813 2355
8...

output:

717727

result:

ok single line: '717727'

Test #40:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

1000
474 2541
794 3628
709 1105
4 3633
393 1663
856 2848
731 4309
748 130
868 94
956 1606
145 2602
616 2602
935 4231
885 803
204 693
842 2089
106 1696
351 880
63 1471
44 775
722 2518
496 2981
405 4514
151 1453
74 2715
560 1420
861 3415
621 4182
316 1194
197 3045
41 4472
710 1647
11 2717
104 2410
509...

output:

938

result:

ok single line: '938'

Test #41:

score: 0
Accepted
time: 2ms
memory: 3452kb

input:

1000
516 5752
610 2047
410 6176
879 1946
607 6888
303 6598
72 1430
848 2688
587 4215
69 260
10 963
390 2467
484 3046
634 1381
946 938
899 7604
243 1300
941 3567
814 1454
96 6223
189 7122
158 7663
122 4320
107 5846
328 4694
616 267
157 6394
139 95
698 4730
96 2242
117 5180
569 1057
612 2436
232 2725
...

output:

11051

result:

ok single line: '11051'

Test #42:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

1000
768 1360
239 2989
87 2251
939 2467
57 1434
719 1576
104 1087
27 3707
624 507
205 823
271 3823
749 865
738 3837
629 889
800 3958
985 2045
903 2223
354 2531
516 1910
2 3783
914 1135
303 955
624 1694
423 1531
603 3436
857 3816
76 2209
933 1662
711 2911
917 2430
838 298
413 4081
479 3229
564 3763
2...

output:

7551

result:

ok single line: '7551'

Test #43:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

833
520 1291
612 5314
720 6179
439 3508
625 7709
319 8285
312 1859
731 2199
574 6596
143 1776
237 7577
181 3490
243 3678
604 5644
24 4207
204 3927
18 2064
564 4017
433 5825
497 706
276 6698
262 1414
644 6215
798 7984
413 5130
650 5294
596 2592
35 1042
158 5816
47 1527
0 101
627 3327
179 2606
231 106...

output:

4300

result:

ok single line: '4300'

Test #44:

score: 0
Accepted
time: 2ms
memory: 3500kb

input:

813
400 5967
81 3054
591 4558
639 7376
15 4228
325 7164
353 762
170 7644
634 3172
684 3014
391 7363
773 7688
526 209
597 2136
524 8192
318 8197
384 5796
376 3450
655 4583
597 3233
635 2210
86 6840
313 3382
80 4223
84 3844
669 776
258 2528
51 3389
309 1935
200 691
119 1653
126 998
329 5037
292 7639
1...

output:

4102

result:

ok single line: '4102'

Test #45:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

620
79 1074
580 678
118 2089
243 2387
160 466
478 1298
22 733
390 1540
320 867
498 1213
405 811
395 94
466 171
603 1982
495 73
25 1806
205 102
455 980
262 838
61 1748
464 122
400 1390
146 1901
170 2433
378 564
560 2235
119 1238
517 1031
550 1784
88 2005
74 1038
578 2474
580 1844
327 1841
438 406
8 1...

output:

1183

result:

ok single line: '1183'

Test #46:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

276
259 553
41 600
191 15
6 75
109 110
53 619
40 228
118 560
101 607
9 127
151 537
156 308
188 276
270 490
172 450
239 577
270 485
253 127
129 456
166 195
61 353
215 121
263 501
221 493
114 295
205 327
36 485
238 284
270 270
154 432
151 254
97 379
14 89
62 540
245 60
52 573
192 614
0 356
24 412
139 ...

output:

657

result:

ok single line: '657'

Test #47:

score: 0
Accepted
time: 1ms
memory: 3452kb

input:

987
24 2574
503 847
712 2555
435 766
323 1562
963 884
755 1687
289 1305
531 1628
749 2606
566 2411
889 293
61 2037
300 1777
212 1982
866 659
333 326
787 1150
901 1985
516 1496
21 1184
73 1943
179 34
746 2237
566 2044
613 2068
321 1406
745 1174
69 728
626 74
110 1390
875 2290
263 2404
527 2203
943 51...

output:

5429

result:

ok single line: '5429'

Test #48:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

425
206 8032
409 6573
423 7220
237 7178
55 2817
305 3473
219 7008
93 3388
202 5
423 6947
192 1712
174 3309
86 8161
387 1927
385 8316
322 3406
402 3426
264 6303
421 8010
255 7855
128 430
209 3366
290 3555
169 606
118 7414
315 6004
395 8395
260 7543
179 3397
76 1765
206 5089
38 615
365 2389
216 4519
2...

output:

18503

result:

ok single line: '18503'

Test #49:

score: 0
Accepted
time: 2ms
memory: 3436kb

input:

883
562 1362
667 2803
781 2069
489 484
171 539
832 1782
269 213
346 267
331 2719
823 2380
18 40
550 1808
861 1922
82 284
280 1232
714 1440
744 2289
806 881
399 744
55 2040
856 2042
655 274
707 431
610 2412
51 2587
834 2857
350 1952
197 2421
469 2599
409 2815
657 1432
3 613
719 2334
376 2367
384 1153...

output:

4097

result:

ok single line: '4097'

Test #50:

score: 0
Accepted
time: 1ms
memory: 3516kb

input:

364
100 360
271 1362
281 1054
197 1495
111 519
57 1087
185 1487
15 878
248 13
43 2173
56 595
297 1571
295 973
217 684
297 1658
17 533
60 1752
147 106
260 715
225 1768
176 846
30 78
170 1858
22 463
247 336
234 1180
19 1327
346 866
335 1472
59 2162
66 1351
77 1804
34 293
181 512
217 20
58 861
293 958
...

output:

549

result:

ok single line: '549'

Test #51:

score: 0
Accepted
time: 1ms
memory: 3448kb

input:

623
457 1286
605 726
143 728
250 2614
383 662
616 2850
585 2778
424 1187
399 945
576 80
506 2212
458 1403
275 1933
145 1876
570 1318
327 1602
99 2941
466 2880
196 767
618 1650
121 2173
205 3054
208 421
220 1482
445 813
187 3158
391 310
292 3238
569 2689
133 1462
562 1925
573 2021
438 2874
451 2317
3...

output:

1237

result:

ok single line: '1237'

Subtask #4:

score: 12
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #52:

score: 12
Accepted
time: 23ms
memory: 6536kb

input:

200000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 10000
200000 ...

output:

2000000000

result:

ok single line: '2000000000'

Test #53:

score: 0
Accepted
time: 29ms
memory: 6544kb

input:

200000
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
200000 0
20000...

output:

0

result:

ok single line: '0'

Test #54:

score: 0
Accepted
time: 487ms
memory: 6288kb

input:

200000
161227 737
56513 654
178342 804
165014 91
180758 296
156528 298
199581 381
156196 50
22147 727
144722 796
177630 358
187155 620
154198 738
162606 806
95136 340
152047 378
161717 485
152379 762
57336 134
158459 660
176648 771
194234 18
196907 653
180506 15
139137 134
150637 574
153079 95
18225...

output:

34365604

result:

ok single line: '34365604'

Test #55:

score: 0
Accepted
time: 431ms
memory: 6288kb

input:

200000
157514 4843
178993 3452
194092 244
173631 4999
173708 1203
165253 5375
151448 828
151890 1552
155499 2559
196208 5026
185544 3101
179400 3443
72722 158
165403 3568
159024 2762
159418 2075
160322 870
165859 6025
181635 2348
181569 4022
172411 4069
166285 5266
163509 2168
28024 3715
163650 1631...

output:

259269938

result:

ok single line: '259269938'

Test #56:

score: 0
Accepted
time: 499ms
memory: 6260kb

input:

200000
360 4681
184088 1818
187745 2813
165639 1558
186733 2068
194163 2592
163977 881
183293 3637
173901 1187
178541 3160
152551 3556
183257 2272
87275 2274
907 5643
180488 2621
77441 4778
152198 4296
164790 3379
184019 2264
181218 451
36913 4294
193136 1969
177905 5674
148794 2767
179741 4833
1681...

output:

248326465

result:

ok single line: '248326465'

Test #57:

score: 0
Accepted
time: 563ms
memory: 6200kb

input:

200000
86663 825
192006 741
104790 1518
188602 630
199809 1245
170181 1256
169070 1354
120588 1678
161102 409
188642 647
195947 944
100130 1113
177069 757
152022 561
144310 308
195032 1421
188531 1206
28103 611
190404 1035
75758 1116
106679 1297
158360 1248
188204 200
187607 1205
117622 1263
176447 ...

output:

76996256

result:

ok single line: '76996256'

Test #58:

score: 0
Accepted
time: 462ms
memory: 6232kb

input:

200000
187190 6104
180625 276
153635 2283
197691 3508
160319 7134
163994 1816
80992 1157
157833 2574
164055 4000
185242 8243
155724 4441
152809 1607
195803 8376
45428 4566
62390 7674
197026 1343
196226 6222
29199 5866
189334 1741
188382 3717
184575 2995
153234 1646
193369 5416
179847 7979
158738 259...

output:

355305505

result:

ok single line: '355305505'

Test #59:

score: 0
Accepted
time: 453ms
memory: 5444kb

input:

200000
198406 206
102099 65
149559 153
53409 91
122531 384
136751 267
122371 253
185687 63
148164 349
166677 317
111139 353
163418 93
67613 353
54905 308
16287 123
66577 54
53111 95
93591 27
146498 93
14611 218
98696 63
140142 112
26877 267
44539 206
17718 382
189347 25
104994 318
196434 14
46469 30...

output:

849

result:

ok single line: '849'

Test #60:

score: 0
Accepted
time: 378ms
memory: 5436kb

input:

200000
101154 1809
21338 1200
195697 2708
171785 3058
74989 1990
168750 4833
164604 3004
128312 3721
35138 4422
7383 879
90630 769
64260 2004
77730 2270
62164 2598
47732 4675
149789 1370
199472 2026
24483 3543
81818 2043
30339 2075
88638 1617
191003 3989
37274 2189
32148 4865
155212 4363
68996 39
94...

output:

29779

result:

ok single line: '29779'

Test #61:

score: 0
Accepted
time: 414ms
memory: 5444kb

input:

200000
25438 3718
64143 3600
160995 8998
194625 9091
71753 2499
198289 8932
26700 8546
188648 3119
170724 2933
72672 6970
93377 9017
140971 9026
54105 111
178619 7075
186881 7781
15101 4382
175796 7710
6773 7853
23808 7991
114453 2730
95737 6549
170728 8740
96565 181
56247 6933
122939 1
17707 1071
1...

output:

70278

result:

ok single line: '70278'

Test #62:

score: 0
Accepted
time: 410ms
memory: 5364kb

input:

194867
176021 2569
13464 103
185640 9
180286 2043
77378 2205
181890 686
29913 1908
88548 1023
14958 851
173691 1146
126094 921
46395 2233
168161 1736
29556 1702
109226 2355
63018 1285
86324 1777
125154 1542
184840 905
53328 2113
107140 887
123327 2653
103033 129
31907 713
173734 202
146987 66
74155 ...

output:

7275

result:

ok single line: '7275'

Test #63:

score: 0
Accepted
time: 173ms
memory: 4364kb

input:

94995
18008 4344
2264 1686
44301 1030
9856 1228
78448 4840
17764 2561
53469 122
72137 5476
85235 2837
2384 852
36694 4832
63396 486
71518 1694
85918 283
88882 4575
33367 3780
80114 4641
14621 2390
10653 4592
46227 185
6484 2483
76209 372
36309 1404
82728 5272
24805 5857
32400 803
72903 5752
22509 42...

output:

8519

result:

ok single line: '8519'

Test #64:

score: 0
Accepted
time: 23ms
memory: 3620kb

input:

14163
9653 329
3671 45
12721 287
1762 308
997 321
1533 93
4718 199
13378 247
8749 98
11269 113
2381 10
3365 65
3090 337
5515 30
6692 357
1641 167
1514 322
9013 130
12135 166
6875 78
4764 172
7390 81
9188 249
5972 98
9359 130
9865 280
6943 188
12393 249
6810 27
6191 140
8790 268
10126 200
12568 42
29...

output:

2227

result:

ok single line: '2227'

Test #65:

score: 0
Accepted
time: 75ms
memory: 3664kb

input:

42688
26336 2400
2796 1319
3458 1819
19396 2948
24360 2229
2538 2389
16297 151
36738 2150
7308 852
5888 1734
36033 1349
6151 1763
33241 2233
42350 1392
41241 2026
41810 1361
8926 2556
6709 2900
193 2910
18438 1931
38267 280
34333 2195
786 2819
32034 1326
22672 2032
5168 1427
6077 1066
12191 2861
399...

output:

2211

result:

ok single line: '2211'

Test #66:

score: 0
Accepted
time: 296ms
memory: 5072kb

input:

157229
103211 3766
107435 6002
153984 8509
150192 40
31875 6917
33580 2755
57799 8600
43698 1348
149180 6681
60405 796
122134 7114
72361 3408
36649 1594
23723 3169
66403 1302
124798 347
43600 3837
45938 5442
80741 2731
43371 987
12394 3401
144468 1333
126681 7815
83207 3514
46679 8414
99277 8322
116...

output:

30149

result:

ok single line: '30149'

Test #67:

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

input:

73951
34505 4763
27314 1010
15551 3502
5800 4433
5394 2277
39324 3073
4248 133
33245 917
41242 5972
26126 3760
57239 6687
46280 3479
29024 4861
50583 7823
4602 1088
825 462
28575 2756
27107 7999
58685 4832
70619 7938
3189 2534
52798 3646
72093 2683
4700 2149
8479 7594
66263 5041
40472 381
69192 7392...

output:

33224

result:

ok single line: '33224'

Test #68:

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

input:

45969
10693 216
29485 1250
865 486
40266 658
6596 1475
10397 975
4053 742
37795 1093
18025 981
18690 457
34398 788
9945 34
32631 787
15367 274
12189 490
2792 1189
9221 1052
36941 1183
34177 1001
40332 1375
123 80
42799 195
19257 1452
18765 1123
35253 1434
28518 824
20858 22
24180 1427
17344 1442
131...

output:

3837

result:

ok single line: '3837'

Test #69:

score: 0
Accepted
time: 331ms
memory: 5332kb

input:

185366
182133 4974
70033 2498
68762 2670
57583 5150
142852 2172
8923 6511
136257 4985
35699 3186
24518 4471
182963 635
93781 1979
131493 2395
127934 955
107951 1862
32406 1979
21340 4299
30871 5964
58007 3992
99806 1423
100028 2346
180555 6312
66716 2691
89077 3665
185264 6008
36969 3440
11111 1575
...

output:

62164

result:

ok single line: '62164'

Test #70:

score: 0
Accepted
time: 258ms
memory: 4612kb

input:

127008
88913 785
10033 105
44496 617
76440 255
65260 48
73384 802
87616 587
7650 167
35777 510
125074 705
80859 494
89944 351
9633 52
61036 31
124682 19
73637 702
15808 420
107425 345
37571 366
123579 760
8431 577
4441 429
45135 245
39801 645
65691 564
13169 457
81519 675
68551 156
66253 774
89048 1...

output:

2263

result:

ok single line: '2263'

Extra Test:

score: 0
Extra Test Passed