QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#670924#2629. Let's Win the Electionliuziao#61 1518ms7892kbC++232.1kb2024-10-24 08:50:372024-10-24 08:50:37

Judging History

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

  • [2024-10-24 08:50:37]
  • 评测
  • 测评结果:61
  • 用时:1518ms
  • 内存:7892kb
  • [2024-10-24 08:50:37]
  • 提交

answer

#include <bits/stdc++.h>

// #define int int64_t

using f64 = long double;
using pii = std::pair<int, int>;

const int kMaxN = 505;
const f64 kEps = 1e-6;

int n, k;
pii a[kMaxN];
f64 f[kMaxN][kMaxN];

f64 func(int cnt) {
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j)
      f[i][j] = 1e9;
  f[0][0] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = cnt; ~j; --j) {
      for (int k = ::k - cnt; ~k; --k) {
        if (j && a[i].second != -1) f[j][k] = std::min(f[j][k], f[j - 1][k] + (f64)a[i].second / j);
        if (k) f[j][k] = std::min(f[j][k], f[j][k - 1] + (f64)a[i].first / (cnt + 1));
      }
    }
  }
  return f[cnt][k - cnt];
}

void dickdreamer() {
  std::cin >> n >> k;
  int can = 0;
  for (int i = 1; i <= n; ++i) {
    std::cin >> a[i].first >> a[i].second;
    if (a[i].second != -1) ++can;
  }
  std::sort(a + 1, a + 1 + n, [&] (pii p1, pii p2) { return p1.second < p2.second; });
  f64 ans = 1e9;
  // for (int cnt = 0; cnt <= std::min(can, k); ++cnt) {
  //   for (int i = 0; i <= n; ++i)
  //     for (int j = 0; j <= n; ++j)
  //       f[i][j] = 1e9;
  //   f[0][0] = 0;
  //   for (int i = 1; i <= n; ++i) {
  //     for (int j = cnt; ~j; --j) {
  //       for (int k = ::k - cnt; ~k; --k) {
  //         if (j && a[i].second != -1) f[j][k] = std::min(f[j][k], f[j - 1][k] + (f64)a[i].second / j);
  //         if (k) f[j][k] = std::min(f[j][k], f[j][k - 1] + (f64)a[i].first / (cnt + 1));
  //       }
  //     }
  //   }
  //   ans = std::min(ans, f[cnt][k - cnt]);
  // }
  int L = 0, R = std::min(can, k) + 1, res = 0;
  while (L + 1 < R) {
    int mid = (L + R) >> 1;
    if (func(mid) <= func(mid - 1) - kEps) L = res = mid;
    else R = mid;
  }
  std::cout << std::fixed << std::setprecision(10) << func(res) << '\n';
}

int32_t main() {
#ifdef ORZXKR
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  int T = 1;
  // std::cin >> T;
  while (T--) dickdreamer();
  // std::cerr << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 3932kb

input:

1
1
729 -1

output:

729.0000000000

result:

ok error = 0.000000000

Test #2:

score: 5
Accepted
time: 0ms
memory: 3900kb

input:

2
2
204 -1
96 -1

output:

300.0000000000

result:

ok error = 0.000000000

Test #3:

score: 5
Accepted
time: 0ms
memory: 3832kb

input:

3
2
639 -1
597 -1
543 -1

output:

1140.0000000000

result:

ok error = 0.000000000

Test #4:

score: 5
Accepted
time: 1ms
memory: 5988kb

input:

4
3
765 -1
121 -1
409 -1
529 -1

output:

1059.0000000000

result:

ok error = 0.000000000

Test #5:

score: 5
Accepted
time: 0ms
memory: 7780kb

input:

500
50
16 -1
224 -1
562 -1
783 -1
830 -1
455 -1
744 -1
170 -1
196 -1
89 -1
80 -1
357 -1
400 -1
443 -1
690 -1
732 -1
705 -1
735 -1
776 -1
820 -1
992 -1
811 -1
690 -1
364 -1
148 -1
246 -1
535 -1
184 -1
951 -1
86 -1
324 -1
2 -1
842 -1
386 -1
55 -1
571 -1
840 -1
689 -1
538 -1
287 -1
310 -1
322 -1
471 -1...

output:

2580.0000000000

result:

ok error = 0.000000000

Test #6:

score: 5
Accepted
time: 2ms
memory: 7608kb

input:

500
125
567 -1
27 -1
102 -1
783 -1
52 -1
120 -1
732 -1
300 -1
193 -1
772 -1
829 -1
109 -1
699 -1
215 -1
392 -1
193 -1
400 -1
260 -1
559 -1
855 -1
974 -1
935 -1
507 -1
773 -1
481 -1
539 -1
369 -1
588 -1
593 -1
922 -1
28 -1
278 -1
553 -1
525 -1
140 -1
845 -1
637 -1
107 -1
641 -1
130 -1
514 -1
104 -1
9...

output:

15729.0000000000

result:

ok error = 0.000000000

Test #7:

score: 5
Accepted
time: 2ms
memory: 7756kb

input:

500
250
76 -1
295 -1
438 -1
389 -1
573 -1
937 -1
359 -1
81 -1
881 -1
565 -1
620 -1
275 -1
52 -1
572 -1
446 -1
942 -1
338 -1
684 -1
657 -1
616 -1
156 -1
648 -1
492 -1
168 -1
711 -1
348 -1
715 -1
868 -1
29 -1
509 -1
483 -1
658 -1
183 -1
214 -1
733 -1
566 -1
388 -1
962 -1
850 -1
44 -1
191 -1
743 -1
143...

output:

66687.0000000000

result:

ok error = 0.000000000

Test #8:

score: 5
Accepted
time: 3ms
memory: 7772kb

input:

500
375
565 -1
295 -1
459 -1
572 -1
658 -1
810 -1
178 -1
13 -1
644 -1
975 -1
150 -1
220 -1
557 -1
156 -1
573 -1
543 -1
325 -1
62 -1
427 -1
599 -1
204 -1
6 -1
892 -1
590 -1
801 -1
338 -1
367 -1
311 -1
890 -1
172 -1
606 -1
300 -1
806 -1
150 -1
814 -1
97 -1
712 -1
769 -1
583 -1
792 -1
24 -1
384 -1
136 ...

output:

147876.0000000000

result:

ok error = 0.000000000

Test #9:

score: 5
Accepted
time: 0ms
memory: 7836kb

input:

500
500
187 -1
429 -1
984 -1
572 -1
718 -1
162 -1
355 -1
922 -1
180 -1
457 -1
881 -1
946 -1
105 -1
273 -1
3 -1
891 -1
290 -1
281 -1
598 -1
432 -1
279 -1
471 -1
123 -1
212 -1
290 -1
975 -1
796 -1
438 -1
43 -1
371 -1
229 -1
121 -1
912 -1
317 -1
41 -1
445 -1
307 -1
777 -1
336 -1
320 -1
699 -1
617 -1
23...

output:

249562.0000000000

result:

ok error = 0.000000000

Test #10:

score: 5
Accepted
time: 2ms
memory: 7772kb

input:

500
350
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000 -1
1000...

output:

350000.0000000000

result:

ok error = 0.000000000

Subtask #2:

score: 0
Time Limit Exceeded

Test #11:

score: 5
Accepted
time: 0ms
memory: 3772kb

input:

1
1
791 791

output:

791.0000000000

result:

ok error = 0.000000000

Test #12:

score: 5
Accepted
time: 139ms
memory: 7776kb

input:

500
150
824 824
524 524
20 20
713 713
668 668
342 342
53 53
660 660
180 180
614 614
504 504
216 216
200 200
551 551
660 660
696 696
194 194
820 820
517 517
209 209
484 484
744 744
904 904
268 268
931 931
265 265
701 701
511 511
591 591
443 443
374 374
296 296
848 848
481 481
771 771
521 521
687 687
...

output:

341.0793145790

result:

ok error = 0.000000000

Test #13:

score: 5
Accepted
time: 256ms
memory: 7712kb

input:

500
150
187 -1
798 798
819 819
927 927
9 -1
742 742
268 -1
453 -1
132 132
947 947
683 -1
156 -1
809 -1
681 -1
472 472
656 -1
177 177
347 347
102 102
45 45
215 -1
580 580
371 371
807 807
625 625
11 11
596 596
34 -1
803 803
360 360
45 -1
613 613
490 -1
871 -1
974 -1
710 -1
308 308
698 -1
117 117
962 -...

output:

355.3422864151

result:

ok error = 0.000000000

Test #14:

score: 5
Accepted
time: 174ms
memory: 7836kb

input:

500
150
910 -1
793 -1
374 374
413 -1
153 153
344 -1
604 -1
793 -1
799 -1
669 669
464 -1
135 135
828 -1
334 -1
983 -1
844 844
443 -1
862 862
589 -1
486 -1
517 517
284 284
962 962
771 771
84 -1
211 211
957 -1
944 944
103 -1
545 -1
394 -1
711 -1
283 -1
317 -1
171 -1
933 -1
857 -1
424 -1
343 -1
746 -1
1...

output:

940.6896888795

result:

ok error = 0.000000000

Test #15:

score: 5
Accepted
time: 684ms
memory: 7892kb

input:

500
350
444 444
264 264
650 650
694 694
794 794
692 692
20 20
753 753
881 881
31 31
951 951
906 906
321 321
741 741
275 275
467 467
848 848
200 200
378 378
560 560
253 253
949 949
536 536
695 695
478 478
804 804
250 250
106 106
757 757
160 160
641 641
189 189
546 546
900 900
619 619
938 938
804 804
...

output:

707.0462281505

result:

ok error = 0.000000000

Test #16:

score: 5
Accepted
time: 1518ms
memory: 7848kb

input:

500
350
443 443
806 806
115 -1
954 954
359 -1
608 608
632 632
736 -1
550 550
388 -1
617 617
301 -1
314 314
459 -1
250 -1
84 84
42 42
716 -1
98 98
234 234
620 620
755 755
958 -1
826 826
564 -1
115 -1
183 183
691 691
741 741
309 309
359 -1
916 -1
760 760
759 759
752 752
779 -1
671 671
176 176
163 163
...

output:

982.1345592058

result:

ok error = 0.000000000

Test #17:

score: 5
Accepted
time: 786ms
memory: 7848kb

input:

500
350
670 -1
837 -1
828 828
945 -1
256 256
780 -1
546 -1
602 602
219 -1
286 -1
927 927
836 -1
878 878
995 -1
346 -1
245 -1
709 -1
692 -1
519 -1
121 -1
419 -1
914 914
660 660
480 -1
738 -1
116 -1
612 -1
665 -1
57 57
891 -1
626 -1
195 -1
684 -1
625 -1
913 -1
438 -1
582 -1
70 70
35 -1
758 -1
141 141
...

output:

1956.1865688047

result:

ok error = 0.000000000

Test #18:

score: 5
Accepted
time: 1367ms
memory: 7844kb

input:

500
500
451 451
72 72
216 216
601 601
431 431
326 326
614 614
774 774
459 459
130 130
241 241
523 523
130 130
519 519
726 726
722 722
309 309
969 969
584 584
189 189
210 210
668 668
498 498
390 390
243 243
188 188
752 752
835 835
864 864
177 177
427 427
19 19
51 51
225 225
398 398
1000 1000
740 740
...

output:

1043.2370845765

result:

ok error = 0.000000000

Test #19:

score: 0
Time Limit Exceeded

input:

500
500
488 488
883 -1
875 875
81 81
528 528
588 588
310 -1
363 363
764 -1
773 773
958 -1
545 545
761 -1
108 -1
625 625
986 986
314 314
496 496
813 813
480 -1
663 -1
777 777
849 849
418 -1
834 834
168 168
854 -1
177 177
24 -1
318 -1
631 -1
698 -1
449 449
238 -1
825 -1
318 318
107 -1
816 816
705 -1
5...

output:


result:


Subtask #3:

score: 11
Accepted

Test #21:

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

input:

7
1
309 988
195 951
51 -1
104 279
498 906
410 498
76 -1

output:

51.0000000000

result:

ok error = 0.000000000

Test #22:

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

input:

7
2
299 867
879 943
170 -1
142 847
219 249
48 119
20 813

output:

68.0000000000

result:

ok error = 0.000000000

Test #23:

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

input:

7
3
150 170
124 765
351 855
139 -1
182 -1
427 531
945 -1

output:

301.5000000000

result:

ok error = 0.000000000

Test #24:

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

input:

7
4
20 385
428 551
324 347
392 940
587 840
756 992
73 417

output:

589.5000000000

result:

ok error = 0.000000000

Test #25:

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

input:

7
5
109 831
41 900
289 743
187 413
77 355
407 427
103 694

output:

517.0000000000

result:

ok error = 0.000000000

Test #26:

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

input:

7
6
72 970
136 440
497 824
445 762
137 424
200 575
101 437

output:

901.0000000000

result:

ok error = 0.000000000

Test #27:

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

input:

7
7
339 840
105 640
121 232
347 387
294 514
421 711
516 812

output:

942.0833333333

result:

ok error = 0.000000000

Test #28:

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

input:

7
5
168 792
231 784
196 761
129 876
172 846
216 740
237 734

output:

881.0000000000

result:

ok error = 0.000000000

Test #29:

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

input:

7
5
393 646
375 666
374 676
320 635
288 668
284 758
333 702

output:

1258.5000000000

result:

ok error = 0.000000000

Test #30:

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

input:

7
5
599 900
304 605
596 983
493 877
547 975
371 712
573 841

output:

1495.8333333333

result:

ok error = 0.000000000

Test #31:

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

input:

7
5
548 747
591 755
649 860
478 675
462 622
663 783
648 879

output:

1505.2500000000

result:

ok error = 0.000000000

Test #32:

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

input:

7
5
419 578
524 716
278 521
465 651
323 544
598 770
797 888

output:

1232.9166666667

result:

ok error = 0.000000000

Test #33:

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

input:

7
5
124 566
135 559
437 697
769 892
273 622
276 583
219 607

output:

958.5000000000

result:

ok error = 0.000000000

Test #34:

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

input:

5
5
334 352
125 463
356 613
178 718
799 919

output:

1023.3333333333

result:

ok error = 0.000000000

Test #35:

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

input:

7
7
35 513
334 576
158 590
471 591
513 610
199 615
786 879

output:

1369.3333333333

result:

ok error = 0.000000000

Subtask #4:

score: 12
Accepted

Test #36:

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

input:

20
3
43 487
143 720
123 886
88 266
639 739
129 522
300 696
88 889
276 550
653 722
92 157
85 674
452 666
290 517
780 801
49 430
633 932
197 421
20 749
286 479

output:

112.0000000000

result:

ok error = 0.000000000

Test #37:

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

input:

20
9
30 114
174 185
50 580
851 893
525 729
167 804
13 48
614 700
244 933
348 357
97 970
539 879
339 344
275 430
619 979
810 847
108 896
590 619
214 343
189 662

output:

372.9166666667

result:

ok error = 0.000000000

Test #38:

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

input:

20
9
208 346
207 411
259 509
644 -1
215 798
335 527
892 998
923 -1
342 639
576 858
275 460
238 951
646 693
820 996
628 -1
461 888
135 395
618 815
370 969
84 812

output:

1021.3333333333

result:

ok error = 0.000000000

Test #39:

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

input:

20
13
81 479
143 725
64 217
153 772
35 263
148 966
92 364
595 835
108 604
320 631
356 997
359 724
49 799
56 992
178 426
36 838
69 500
440 985
211 850
339 680

output:

719.5000000000

result:

ok error = 0.000000000

Test #40:

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

input:

20
13
553 807
91 241
34 935
168 -1
563 641
809 855
877 -1
371 920
302 755
70 517
378 403
646 838
870 977
491 -1
71 263
817 -1
263 427
178 265
270 585
512 891

output:

997.5309523810

result:

ok error = 0.000000000

Test #41:

score: 12
Accepted
time: 1ms
memory: 3944kb

input:

20
13
927 992
102 320
91 585
414 622
417 853
68 402
528 -1
89 595
612 684
542 -1
165 224
379 -1
327 829
332 859
486 715
455 523
598 -1
791 791
680 -1
373 -1

output:

1174.0071428571

result:

ok error = 0.000000000

Test #42:

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

input:

20
14
100 421
95 842
205 940
250 955
465 975
276 903
209 549
354 400
60 617
241 340
131 446
329 633
469 610
335 917
96 979
108 794
321 628
154 801
805 816
354 523

output:

1127.8833333333

result:

ok error = 0.000000000

Test #43:

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

input:

20
14
902 908
637 708
347 471
624 712
79 -1
923 -1
398 588
355 808
802 868
284 892
129 974
958 -1
811 -1
735 912
483 806
114 999
439 874
247 855
258 820
825 872

output:

1750.6000000000

result:

ok error = 0.000000000

Test #44:

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

input:

20
14
83 -1
620 743
854 -1
581 844
2 79
739 -1
375 -1
185 367
100 139
440 471
569 -1
36 330
421 967
190 615
323 -1
155 325
6 -1
187 838
102 704
341 -1

output:

716.6166666667

result:

ok error = 0.000000000

Test #45:

score: 12
Accepted
time: 1ms
memory: 4024kb

input:

20
20
190 949
208 236
517 597
261 438
442 567
52 458
464 595
135 236
917 963
491 855
25 890
324 950
301 826
375 801
142 474
109 146
84 378
29 541
602 633
438 786

output:

1160.7068181818

result:

ok error = 0.000000000

Test #46:

score: 12
Accepted
time: 1ms
memory: 3988kb

input:

20
20
454 734
194 957
163 811
273 526
614 753
709 882
528 964
437 460
238 333
443 580
662 810
227 430
289 355
241 985
973 -1
823 914
499 942
291 557
521 -1
321 743

output:

1727.1043456543

result:

ok error = 0.000000000

Test #47:

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

input:

20
13
58 956
58 943
50 913
86 939
16 1000
91 914
19 1000
94 903
30 951
79 899
14 1000
103 929
33 1000
85 939
26 1000
33 982
99 896
78 944
75 939
100 945

output:

569.0000000000

result:

ok error = 0.000000000

Test #48:

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

input:

20
14
167 790
133 905
164 791
135 906
135 833
202 765
227 778
213 771
213 832
253 764
200 809
172 844
137 823
157 890
220 828
171 853
198 813
130 898
230 802
229 786

output:

1779.5000000000

result:

ok error = 0.000000000

Test #49:

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

input:

20
13
359 627
377 646
366 655
335 627
325 648
370 680
263 696
309 650
356 665
299 686
348 692
377 597
355 606
313 706
353 621
327 682
291 736
369 640
283 700
339 632

output:

1790.8166666667

result:

ok error = 0.000000000

Test #50:

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

input:

20
14
425 616
440 569
504 528
437 585
437 600
408 560
460 515
468 568
479 530
457 532
416 562
455 565
446 521
427 548
477 500
470 542
494 540
469 502
461 571
484 541

output:

1657.0247474747

result:

ok error = 0.000000000

Test #51:

score: 12
Accepted
time: 1ms
memory: 6000kb

input:

20
13
261 719
256 757
267 728
278 761
204 816
278 759
221 765
257 780
225 775
223 777
222 756
277 712
219 809
240 795
251 724
212 783
211 755
229 721
229 812
284 724

output:

1861.5833333333

result:

ok error = 0.000000000

Test #52:

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

input:

20
14
455 516
456 528
472 564
444 521
428 522
467 517
463 530
481 538
453 506
467 567
464 549
454 547
469 524
435 518
457 502
467 558
465 566
488 562
449 547
468 573

output:

1661.0551226551

result:

ok error = 0.000000000

Test #53:

score: 12
Accepted
time: 1ms
memory: 3972kb

input:

20
13
402 593
433 574
415 559
449 573
407 615
433 607
427 525
454 593
442 546
397 621
431 550
361 663
364 603
413 597
421 541
341 617
430 598
436 592
363 674
359 659

output:

1676.9666666667

result:

ok error = 0.000000000

Test #54:

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

input:

20
13
316 579
438 648
314 585
394 677
429 791
610 957
281 539
384 555
501 831
499 721
390 686
391 537
362 664
391 550
349 582
443 841
506 753
556 919
316 558
478 716

output:

1705.3797619048

result:

ok error = 0.000000000

Test #55:

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

input:

20
14
405 544
489 631
531 670
474 720
578 774
638 837
624 822
484 714
489 713
630 882
454 650
424 558
491 655
597 909
497 632
494 680
420 512
518 643
562 777
490 689

output:

1853.2936507937

result:

ok error = 0.000000000

Test #56:

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

input:

20
13
458 649
630 847
364 500
611 706
681 823
707 832
447 628
810 988
796 944
420 515
419 566
506 557
595 823
653 843
368 508
595 741
477 537
501 608
720 980
456 523

output:

1701.4515873016

result:

ok error = 0.000000000

Test #57:

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

input:

20
14
550 622
524 577
450 503
737 834
721 822
458 512
752 890
468 560
591 610
687 733
472 520
481 562
871 953
595 679
590 603
684 830
446 543
648 701
691 773
848 925

output:

1784.7265706516

result:

ok error = 0.000000000

Test #58:

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

input:

20
13
423 553
624 670
517 554
541 638
630 642
491 605
935 935
450 509
663 663
843 876
560 618
422 503
675 716
438 519
476 584
648 752
587 708
722 754
987 987
721 820

output:

1733.1043290043

result:

ok error = 0.000000000

Test #59:

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

input:

20
14
396 624
742 811
796 892
706 812
882 889
408 648
234 536
951 983
525 694
374 571
626 739
832 901
780 841
976 976
882 925
817 876
840 917
497 630
713 771
649 762

output:

2064.8477688978

result:

ok error = 0.000000000

Test #60:

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

input:

20
13
388 666
107 511
908 973
222 535
726 820
850 927
344 620
696 822
492 720
404 673
603 791
754 827
233 577
522 759
561 763
571 741
655 772
211 526
907 983
812 858

output:

1816.2440476190

result:

ok error = 0.000000000

Subtask #5:

score: 33
Accepted

Test #61:

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

input:

100
15
824 961
637 866
334 751
463 701
28 953
68 168
589 741
107 298
690 754
20 869
686 990
151 659
90 234
279 477
210 337
481 626
347 916
428 580
445 708
239 584
306 495
932 978
84 896
39 199
498 609
308 668
301 605
275 664
426 444
220 345
429 488
365 698
364 681
57 156
129 824
166 931
412 855
745 ...

output:

324.3333333333

result:

ok error = 0.000000000

Test #62:

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

input:

100
15
699 980
501 508
700 814
511 619
535 922
883 962
945 -1
686 735
858 884
819 -1
904 966
828 -1
755 766
657 980
633 679
620 867
553 809
900 996
515 819
969 -1
994 -1
898 902
572 704
820 -1
832 -1
768 831
660 845
609 840
578 -1
766 978
723 852
663 934
728 929
660 667
729 990
773 852
654 691
603 -...

output:

1892.3205266955

result:

ok error = 0.000000000

Test #63:

score: 33
Accepted
time: 3ms
memory: 4464kb

input:

100
30
158 260
214 701
448 516
193 925
222 372
325 419
192 680
52 712
750 865
409 445
98 304
694 802
100 452
446 562
232 986
27 723
475 675
404 497
99 743
274 402
81 703
134 147
493 551
504 821
192 688
503 958
432 500
761 917
26 207
152 292
443 891
635 811
73 241
539 645
679 961
115 380
343 475
445 ...

output:

646.3428571429

result:

ok error = 0.000000000

Test #64:

score: 33
Accepted
time: 3ms
memory: 4392kb

input:

100
30
757 797
697 846
669 750
588 632
540 588
856 1000
725 864
680 865
576 927
546 886
805 831
677 759
642 644
662 885
559 805
955 988
500 583
630 955
853 928
634 764
522 840
716 -1
520 539
512 -1
581 930
662 688
569 676
591 728
501 998
657 748
552 -1
808 -1
752 885
869 874
710 803
640 950
842 914
...

output:

2424.8503110795

result:

ok error = 0.000000000

Test #65:

score: 33
Accepted
time: 7ms
memory: 6112kb

input:

100
50
533 958
616 784
675 816
653 984
735 993
777 872
570 685
605 800
800 933
560 941
734 910
563 765
868 996
720 732
509 928
567 701
815 885
662 774
599 724
542 669
774 949
715 932
611 642
519 675
655 867
571 586
789 807
635 839
734 863
672 714
768 965
597 890
520 722
637 971
529 713
691 864
578 6...

output:

2866.6789228134

result:

ok error = 0.000000000

Test #66:

score: 33
Accepted
time: 6ms
memory: 6096kb

input:

100
50
375 612
726 766
536 559
768 874
425 812
168 467
60 864
486 635
594 767
468 -1
777 -1
315 532
574 -1
407 962
55 -1
441 878
118 309
167 939
661 873
285 306
608 703
382 474
237 -1
277 305
302 913
66 151
514 562
445 498
489 628
864 970
315 417
206 396
58 542
541 845
590 -1
254 480
180 830
671 735...

output:

945.4370896389

result:

ok error = 0.000000000

Test #67:

score: 33
Accepted
time: 11ms
memory: 6268kb

input:

100
65
150 727
85 973
549 685
57 819
776 937
32 163
333 826
67 217
184 199
436 937
743 880
16 59
299 638
91 457
176 747
322 337
307 973
76 407
118 908
350 653
680 784
303 501
236 502
107 456
342 500
211 738
370 507
10 652
64 448
84 654
465 785
425 604
508 883
246 863
109 567
79 910
422 916
32 270
38...

output:

984.3445000390

result:

ok error = 0.000000000

Test #68:

score: 33
Accepted
time: 7ms
memory: 5936kb

input:

100
65
678 815
589 -1
604 931
619 744
521 -1
568 977
744 911
870 880
802 955
538 699
845 986
671 758
870 952
537 916
863 940
529 -1
582 872
825 970
544 722
557 785
722 859
604 987
796 878
665 983
653 667
556 976
575 730
667 -1
884 -1
509 550
970 972
821 903
763 878
683 -1
643 -1
553 845
506 943
591 ...

output:

3132.9647579540

result:

ok error = 0.000000000

Test #69:

score: 33
Accepted
time: 18ms
memory: 6292kb

input:

100
80
548 849
526 901
709 982
504 528
563 600
550 843
812 987
725 932
560 836
587 934
835 863
791 967
724 973
667 687
704 737
552 780
821 891
676 973
783 901
644 998
521 806
611 942
523 537
733 795
844 976
805 901
870 877
928 935
637 717
719 764
672 720
576 597
738 999
581 885
632 645
563 934
729 9...

output:

3152.9110642795

result:

ok error = 0.000000000

Test #70:

score: 33
Accepted
time: 16ms
memory: 4268kb

input:

100
80
19 799
450 696
371 515
690 -1
2 -1
214 380
275 551
95 291
658 -1
131 458
348 404
487 919
55 895
344 -1
503 933
85 601
464 833
206 350
285 322
383 552
186 354
112 787
710 728
169 837
236 262
285 -1
211 904
86 235
913 -1
664 -1
194 771
149 164
130 -1
377 774
52 844
415 835
400 922
864 -1
251 73...

output:

1227.6118437324

result:

ok error = 0.000000000

Test #71:

score: 33
Accepted
time: 30ms
memory: 4456kb

input:

100
100
688 926
92 451
230 452
706 962
21 633
177 969
94 518
536 970
127 981
392 428
53 483
163 757
21 246
129 216
46 418
146 457
121 851
193 268
547 671
121 969
680 810
779 878
96 975
305 830
475 799
33 998
366 585
164 647
166 544
147 628
855 956
575 714
213 864
26 910
388 968
530 831
609 824
158 3...

output:

1732.0259229714

result:

ok error = 0.000000000

Test #72:

score: 33
Accepted
time: 22ms
memory: 6368kb

input:

100
100
927 936
942 -1
755 -1
592 657
542 551
742 817
837 1000
572 721
534 597
928 996
588 638
588 833
659 749
921 937
800 869
657 870
695 923
746 927
758 909
548 953
514 683
964 -1
585 686
575 579
692 873
720 -1
591 781
552 929
688 763
694 -1
792 851
644 711
812 -1
548 912
551 799
787 798
899 972
5...

output:

3448.0214158294

result:

ok error = 0.000000000

Test #73:

score: 33
Accepted
time: 8ms
memory: 4392kb

input:

100
65
204 836
261 789
215 795
169 860
127 895
173 825
218 812
189 768
235 748
157 845
145 873
212 814
151 881
153 811
244 737
255 780
137 830
181 842
201 790
201 749
187 768
128 912
207 758
140 894
104 862
144 891
230 751
181 775
173 837
178 866
229 736
235 787
174 779
221 824
183 845
167 850
218 7...

output:

2854.2723304473

result:

ok error = 0.000000000

Test #74:

score: 33
Accepted
time: 8ms
memory: 6444kb

input:

100
65
353 626
377 637
268 750
390 637
291 714
248 747
289 665
340 702
293 691
400 618
280 755
281 765
358 653
331 620
359 605
299 673
328 687
368 660
278 716
371 630
290 673
378 576
303 656
350 633
381 608
388 631
287 721
271 764
338 648
335 701
276 774
287 716
350 665
258 767
316 658
310 643
311 7...

output:

2704.4200840421

result:

ok error = 0.000000000

Test #75:

score: 33
Accepted
time: 11ms
memory: 4268kb

input:

100
65
468 539
403 601
472 493
478 499
504 546
447 579
443 591
431 558
430 562
415 589
444 534
404 563
467 540
454 583
400 601
467 538
508 538
494 535
453 588
455 595
462 522
483 556
488 512
433 534
400 594
437 533
439 540
401 590
449 536
437 554
460 521
482 510
413 546
407 596
410 561
434 556
458 5...

output:

2421.8092932050

result:

ok error = 0.000000000

Test #76:

score: 33
Accepted
time: 9ms
memory: 4472kb

input:

100
65
58 902
483 548
153 823
261 724
80 931
399 622
185 823
327 716
481 530
166 837
237 753
106 884
288 690
418 631
33 966
203 751
36 929
279 680
201 779
137 867
379 656
454 511
451 504
338 642
110 857
179 852
401 592
261 719
157 872
222 767
151 851
261 776
58 950
262 721
231 816
198 842
169 862
20...

output:

2114.6567973693

result:

ok error = 0.000000000

Test #77:

score: 33
Accepted
time: 12ms
memory: 4400kb

input:

100
65
482 839
500 735
514 896
510 796
463 835
330 637
545 914
463 822
530 908
542 843
286 554
348 601
366 528
561 937
622 961
503 852
398 659
464 705
455 868
556 825
513 973
324 500
526 775
504 918
321 560
351 586
326 534
527 979
447 736
601 974
437 632
438 808
283 575
454 746
405 754
481 832
432 7...

output:

2666.0489753128

result:

ok error = 0.000000000

Test #78:

score: 33
Accepted
time: 6ms
memory: 6504kb

input:

100
65
559 729
591 681
749 887
734 892
503 592
603 794
481 638
766 912
515 635
610 694
655 845
516 600
629 714
762 908
512 698
586 777
852 993
619 849
484 640
617 788
566 747
763 926
497 684
646 844
596 691
823 997
705 932
600 779
664 800
732 834
636 721
704 925
422 598
719 986
731 950
677 867
728 9...

output:

2807.7078472080

result:

ok error = 0.000000000

Test #79:

score: 33
Accepted
time: 6ms
memory: 4460kb

input:

100
65
755 826
806 912
988 988
359 543
887 893
356 542
498 662
759 828
557 688
890 921
418 644
760 836
740 813
375 579
405 630
541 708
794 843
750 817
982 986
748 867
989 996
499 691
616 724
778 841
275 508
524 657
470 644
699 762
901 901
830 871
429 574
433 620
611 703
964 990
274 555
440 607
351 5...

output:

2610.9578556339

result:

ok error = 0.000000000

Test #80:

score: 33
Accepted
time: 12ms
memory: 4396kb

input:

100
65
145 538
237 616
282 607
562 765
569 797
370 679
796 929
962 962
457 684
623 769
885 964
395 690
234 630
371 700
715 861
704 847
638 821
304 611
441 675
130 540
421 722
848 944
591 820
600 819
416 687
735 848
754 860
302 615
109 566
324 640
888 914
542 728
456 737
474 729
469 737
648 788
900 9...

output:

2656.8567465914

result:

ok error = 0.000000000

Subtask #6:

score: 0
Time Limit Exceeded

Test #81:

score: 0
Time Limit Exceeded

input:

500
500
215 315
169 657
849 974
865 984
799 919
681 905
236 828
612 980
342 741
203 235
955 997
456 691
358 1000
617 965
691 912
10 295
426 646
72 725
242 788
171 742
256 696
157 347
151 397
229 798
323 427
133 368
833 993
266 525
254 915
371 438
700 889
235 654
400 953
52 277
31 562
15 298
244 383
...

output:


result:


Subtask #7:

score: 0
Time Limit Exceeded

Test #88:

score: 23
Accepted
time: 30ms
memory: 7840kb

input:

500
50
170 253
450 885
684 995
425 830
76 273
249 856
188 360
410 635
457 765
184 217
364 807
74 675
504 883
768 975
714 814
222 922
144 940
704 878
780 949
256 325
113 997
436 692
683 812
154 655
227 816
666 750
645 940
537 579
267 671
474 972
188 403
65 459
606 671
375 495
590 722
238 998
157 790
...

output:

368.1297619048

result:

ok error = 0.000000000

Test #89:

score: 23
Accepted
time: 32ms
memory: 7784kb

input:

500
50
621 709
721 966
896 937
884 911
865 993
714 915
736 840
740 753
615 796
717 976
825 872
622 788
955 964
903 983
882 972
643 797
648 826
648 855
784 839
871 935
683 813
885 968
706 707
636 844
896 933
737 743
629 909
905 936
688 957
712 767
972 983
678 900
633 731
683 985
843 987
689 835
812 9...

output:

2882.4745823040

result:

ok error = 0.000000000

Test #90:

score: 23
Accepted
time: 215ms
memory: 7772kb

input:

500
125
343 870
15 907
372 477
393 818
503 521
415 979
129 385
415 578
242 983
211 233
215 531
193 910
791 875
543 674
153 443
301 419
308 368
263 474
76 454
334 691
510 788
108 152
129 476
408 459
200 640
496 633
484 912
558 953
39 331
490 899
653 762
262 310
724 857
133 896
44 967
489 829
776 919
...

output:

641.5151181260

result:

ok error = 0.000000000

Test #91:

score: 23
Accepted
time: 177ms
memory: 7648kb

input:

500
125
785 890
963 978
640 690
657 926
847 926
602 714
882 910
806 933
632 941
674 923
764 864
664 842
793 832
714 859
717 783
641 795
702 716
753 809
600 615
786 821
706 945
672 700
754 773
864 901
849 908
620 986
795 994
831 835
830 857
830 833
741 858
639 963
698 827
729 916
614 732
602 757
629 ...

output:

3543.8836038744

result:

ok error = 0.000000000

Test #92:

score: 23
Accepted
time: 980ms
memory: 7840kb

input:

500
250
904 938
748 933
232 445
209 736
251 399
156 840
29 923
131 988
200 214
271 773
552 664
157 827
181 641
160 913
405 915
544 571
218 448
126 916
112 694
438 536
488 944
708 922
299 688
233 723
103 962
62 85
525 581
438 581
695 852
834 981
131 379
41 614
491 663
299 585
447 680
176 434
75 157
3...

output:

955.8861020681

result:

ok error = 0.000000000

Test #93:

score: 23
Accepted
time: 782ms
memory: 7644kb

input:

500
250
629 951
763 855
614 864
667 962
692 827
634 855
920 986
970 997
600 641
680 885
744 746
907 966
796 798
716 761
621 854
815 872
843 905
809 992
682 891
748 790
706 750
698 897
680 772
714 779
662 987
890 905
670 857
785 837
773 875
807 812
784 872
658 925
629 962
837 993
659 765
743 1000
658...

output:

4225.9687876561

result:

ok error = 0.000000000

Test #94:

score: 0
Time Limit Exceeded

input:

500
375
332 564
621 979
202 471
174 761
757 895
385 847
535 777
200 737
346 394
124 748
154 455
239 863
714 715
60 862
452 588
671 729
224 398
419 870
148 437
968 976
140 419
14 991
124 280
175 699
185 679
110 345
107 633
629 842
53 278
796 800
174 420
750 954
20 477
834 872
11 780
426 760
696 983
9...

output:


result: