QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#21206 | #790. Sure Bet | adventitious | 100 ✓ | 111ms | 5404kb | C++20 | 1.2kb | 2022-03-03 11:35:17 | 2022-05-08 02:30:46 |
Judging History
answer
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
using namespace std;
#define ALL(c) (c).begin(),(c).end()
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }
typedef pair<int,int> PII;
typedef long long int64;
int n=0;
double a[100000],b[100000];
int main() {
cin >> n;
REP (i,n) {
cin >> a[i] >> b[i];
a[i]-=1; b[i]-=1;
}
sort(a,a+n); reverse(a,a+n);
sort(b,b+n); reverse(b,b+n);
int i=0,j=0;
double r=0;
double sa=0,sb=0;
while (i<n) {
sa+=a[i];
i++;
while (j<n && min(sa-j,sb-i)<min(sa-(j+1),(sb+b[j])-i)) {
sb+=b[j];
j++;
}
r=max(r, min(sa-j,sb-i));
}
printf("%.4f\n",r);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 0ms
memory: 3828kb
input:
1 1.5818 2.3581
output:
0.0000
result:
ok single line: '0.0000'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3780kb
input:
1 5.6497 2.8700
output:
0.8700
result:
ok single line: '0.8700'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
10 1.9129 1.4541 1.5695 2.5926 2.9460 2.9539 2.5873 1.7263 2.1710 2.0985 2.5549 2.5436 1.8722 1.9287 2.7393 1.3761 1.9167 1.1926 1.8669 1.2680
output:
2.1886
result:
ok single line: '2.1886'
Test #4:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
10 3.3075 4.3820 3.1289 1.7225 3.0509 3.7184 1.2061 2.4154 1.2605 1.1585 3.5097 5.6962 1.1909 5.9109 1.6837 4.7381 2.6821 4.6537 3.7975 2.9829
output:
9.9989
result:
ok single line: '9.9989'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3788kb
input:
10 10.2742 9.4475 5.3252 4.0726 2.4876 8.1789 6.2043 5.1920 6.9240 4.6176 10.8893 8.6792 1.6593 8.6687 7.6919 1.7039 6.1317 10.1668 2.7686 6.4622
output:
42.3561
result:
ok single line: '42.3561'
Test #6:
score: 0
Accepted
time: 3ms
memory: 3784kb
input:
10 4.0530 1.2670 4.3790 2.1420 1.9230 2.1920 3.3740 1.0850 0.9690 3.4510 1.5270 0.5160 4.3860 1.3360 4.5560 1.5050 4.9650 1.8120 0.6250 0.4820
output:
3.7050
result:
ok single line: '3.7050'
Subtask #2:
score: 40
Accepted
Dependency #1:
100%
Accepted
Test #7:
score: 40
Accepted
time: 0ms
memory: 3824kb
input:
100 1.4956 1.1946 1.1501 2.2415 1.3497 1.2463 2.4664 1.1596 1.3010 2.1184 1.5247 1.7278 1.2486 2.1710 1.4974 2.3624 1.1575 1.2074 1.8832 2.3170 2.0127 1.6075 2.2812 1.4922 2.2704 2.3269 1.4242 1.2977 1.4176 1.1737 2.0765 2.3766 1.9800 1.5083 1.5368 1.5043 2.0044 1.3901 2.0379 1.9975 1.8910 2.0809 1....
output:
8.5323
result:
ok single line: '8.5323'
Test #8:
score: 0
Accepted
time: 3ms
memory: 3760kb
input:
100 2.4132 2.0942 1.6137 2.8098 1.3887 2.4661 1.1785 2.8480 2.2728 2.4232 1.5727 1.2391 2.4155 2.4439 1.8201 1.3103 1.9930 1.1024 2.5548 1.3482 1.8885 1.3777 1.1193 2.4415 1.2160 2.0071 2.7317 2.5891 2.4978 2.8527 2.0843 2.3946 2.6898 2.6764 1.7740 1.0824 2.6940 2.0821 1.5553 1.6771 1.7745 1.5961 1....
output:
24.1350
result:
ok single line: '24.1350'
Test #9:
score: 0
Accepted
time: 3ms
memory: 3816kb
input:
100 4.3202 5.5071 3.8447 5.0822 5.2361 5.8633 4.4495 1.2638 5.5369 3.2431 4.9318 2.5748 5.3193 2.9033 4.8342 4.0382 1.8404 5.3524 2.9661 2.0030 1.1759 4.4111 1.0110 4.3441 5.6675 1.7736 4.8196 2.2381 2.2736 4.7274 1.7325 1.9081 5.5780 2.8860 5.7038 2.4561 5.0267 2.9750 2.2434 4.1860 5.5573 4.1076 4....
output:
159.9286
result:
ok single line: '159.9286'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3724kb
input:
100 3.1910 5.7730 3.5047 5.3189 1.6328 2.4024 1.9362 1.4570 1.3668 2.2757 1.7456 2.5014 2.1869 4.8945 3.6875 4.6803 1.5333 4.2750 2.3119 5.1432 3.4557 2.1383 1.2557 1.1699 1.0526 2.6194 3.6757 4.3012 2.7782 2.6058 1.1896 3.1184 2.8733 5.7949 3.4482 3.5176 3.2329 1.7566 1.2180 5.2011 1.5535 4.0936 2....
output:
95.9766
result:
ok single line: '95.9766'
Test #11:
score: 0
Accepted
time: 3ms
memory: 3868kb
input:
100 922.2115 20.0421 315.8104 440.3790 155.3446 382.9488 786.0287 713.0946 40.6376 343.7968 750.9175 747.2939 931.0735 304.4101 19.0595 555.9315 71.4925 725.2374 217.2002 525.3174 826.4059 309.1864 738.2837 749.3515 67.8040 621.2098 664.0256 324.6644 123.2905 432.2591 959.6163 254.7484 827.0268 941....
output:
48176.6199
result:
ok single line: '48176.6199'
Test #12:
score: 0
Accepted
time: 4ms
memory: 3928kb
input:
1000 1.3377 1.4429 1.9909 1.4286 2.4383 1.0961 1.9213 1.1800 1.6741 1.5620 1.5439 2.2828 1.2075 1.0909 1.9115 2.3482 2.4127 1.4521 1.2117 2.4097 1.5412 1.8514 1.5132 1.6814 1.5709 1.1130 2.0176 1.8555 1.9174 1.5098 2.0283 1.4707 1.2152 1.3350 2.4859 1.1161 2.3196 2.3973 1.5139 2.1482 2.3963 1.5439 1...
output:
83.1879
result:
ok single line: '83.1879'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3772kb
input:
1000 1.4872 1.0556 1.0004 2.3216 1.8358 1.6894 1.4613 2.1074 1.2129 2.9058 1.7366 1.7986 2.5265 2.3401 2.3200 2.4680 2.1050 2.9516 2.2211 2.4817 1.2865 1.4895 1.0479 2.2564 2.1736 1.3853 1.0894 2.7913 2.3589 2.9106 2.3523 2.3008 1.5885 2.5570 1.1878 2.3424 2.4694 2.0380 1.6303 2.8832 2.7691 1.8148 1...
output:
245.7143
result:
ok single line: '245.7143'
Test #14:
score: 0
Accepted
time: 3ms
memory: 3748kb
input:
1000 3.7222 2.7909 2.6717 5.4516 5.3668 4.3860 5.6181 1.4846 4.9543 1.5916 5.0647 5.0400 1.8757 2.6848 5.3706 5.2681 5.5697 3.4043 5.2686 4.2119 5.9629 4.2116 5.1118 1.6348 1.5193 2.0575 4.0216 1.6900 4.9398 5.8625 5.7535 1.1974 5.7806 1.3368 1.3721 1.0648 5.7572 2.4876 4.2614 5.4548 3.2426 4.5155 3...
output:
1647.3979
result:
ok single line: '1647.3979'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
1000 2.7490 5.5862 3.2015 1.2435 2.2185 3.0674 1.8712 2.3415 2.1388 3.2847 2.0884 1.0658 3.1240 3.3488 3.5982 5.2187 1.4137 1.8423 3.5641 5.9231 1.6284 4.3913 2.5965 3.8156 1.3483 4.2510 3.4580 2.5689 2.5954 2.9547 3.8849 3.8202 1.2858 2.0150 2.2439 1.4311 2.6327 4.6717 1.9148 5.2082 3.3287 4.4088 2...
output:
995.7657
result:
ok single line: '995.7657'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
1000 726.0629 892.9662 896.8675 621.2117 2.9227 332.2688 246.7229 42.2426 893.7779 519.3388 999.5746 558.1455 590.7614 219.9117 361.0638 693.1156 989.1241 880.8610 490.9273 777.9058 889.4327 159.1614 116.1979 266.9677 408.6453 736.4850 223.7709 607.8263 591.6783 929.6578 771.0877 714.1177 710.5037 4...
output:
503832.1055
result:
ok single line: '503832.1055'
Subtask #3:
score: 40
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #17:
score: 40
Accepted
time: 91ms
memory: 5368kb
input:
100000 1.3380 1.7759 1.0887 2.3199 1.8572 1.6178 2.3138 2.3453 2.3543 1.5118 1.8427 2.4644 1.2276 1.2042 1.0102 2.2383 2.4657 1.5298 1.8356 1.9481 2.1909 1.2976 2.0381 1.7576 1.9292 1.8823 1.4935 1.1315 2.1802 2.0888 1.0710 2.4146 1.9177 1.7647 1.1403 1.3784 1.7138 1.6797 1.8888 1.0105 1.8443 2.2281...
output:
8355.5996
result:
ok single line: '8355.5996'
Test #18:
score: 0
Accepted
time: 105ms
memory: 5332kb
input:
100000 2.9761 1.1966 1.3462 2.9137 2.2390 2.6214 2.1449 2.2078 1.2206 1.6171 1.9718 2.5641 1.4716 1.6977 1.7920 2.4504 1.5458 2.1588 2.3830 2.1864 2.6313 1.8914 2.6314 2.0965 2.0015 2.5457 1.9933 2.4615 2.7489 2.4338 1.8759 1.8610 1.2957 1.8552 2.9220 1.6291 2.1469 1.7593 2.6739 2.2417 2.8949 1.9940...
output:
24896.5589
result:
ok single line: '24896.5589'
Test #19:
score: 0
Accepted
time: 94ms
memory: 5316kb
input:
100000 3.3223 5.9105 2.6922 1.7455 2.2814 1.1976 3.9812 4.9699 1.1007 5.8888 2.1568 2.4740 3.0683 3.0750 4.1066 1.6153 5.7729 2.0088 3.5758 4.4475 1.0275 1.6208 1.1945 2.9799 2.8272 2.5500 5.3851 5.7539 4.7457 5.3717 3.2859 1.4766 5.6557 1.5862 5.7445 2.8173 2.1123 3.6604 2.1841 5.2716 2.1433 4.7069...
output:
159845.0574
result:
ok single line: '159845.0574'
Test #20:
score: 0
Accepted
time: 95ms
memory: 5200kb
input:
100000 3.0742 4.5430 3.8785 4.7417 3.1368 3.2496 1.0270 4.0171 3.5333 4.9666 3.3794 4.8439 2.7038 2.8719 1.8810 3.4796 3.1138 4.7997 1.9964 2.6425 3.0622 4.7968 1.2314 1.1720 2.2850 3.6616 3.9400 3.2178 3.1936 2.8638 1.2252 1.1717 1.5023 4.3542 3.2943 4.0477 2.7064 3.0424 2.1216 4.0694 1.7890 3.1860...
output:
98654.5672
result:
ok single line: '98654.5672'
Test #21:
score: 0
Accepted
time: 109ms
memory: 5292kb
input:
100000 440.9763 794.1026 262.8375 503.5779 982.3591 48.3529 264.4032 148.4827 61.8903 380.1293 625.2970 782.4030 890.7147 6.1548 612.0006 416.4769 117.8328 334.9773 514.2626 826.3536 630.8166 940.1272 141.3121 515.7643 151.5049 105.9338 765.3896 734.8565 470.9495 35.8529 803.1512 326.9217 868.1065 8...
output:
49969193.6436
result:
ok single line: '49969193.6436'
Test #22:
score: 0
Accepted
time: 96ms
memory: 5272kb
input:
100000 2.2808 1.0523 1.0262 2.0692 1.6657 2.4048 1.9321 1.0264 1.2941 1.6660 1.0191 1.9236 2.0438 2.1947 2.1530 2.0731 2.4354 1.4693 2.3408 1.8771 2.0475 2.3972 2.0958 1.5601 2.0721 1.0203 2.1182 2.0100 1.3729 1.9323 1.6256 1.1744 1.6170 2.1482 1.4918 2.2848 1.0038 1.8202 2.2592 2.1961 1.9458 1.4091...
output:
8357.0937
result:
ok single line: '8357.0937'
Test #23:
score: 0
Accepted
time: 95ms
memory: 5312kb
input:
100000 1.1226 1.0190 1.6930 2.1800 1.6965 2.7342 1.0549 2.0616 2.1940 1.3409 1.2652 1.1269 2.0711 2.3008 1.7869 2.2213 1.3165 2.1523 1.3323 1.9664 2.3556 2.8589 2.3817 2.5963 2.5932 2.6921 1.7680 2.3514 2.1426 1.7353 2.5548 2.4326 2.2291 2.5567 2.3723 2.6050 1.2471 2.1496 2.1280 2.5372 1.4891 1.3276...
output:
25025.0727
result:
ok single line: '25025.0727'
Test #24:
score: 0
Accepted
time: 95ms
memory: 5340kb
input:
100000 4.7920 5.2746 2.1624 1.9273 4.1887 3.0413 2.4045 3.9350 4.8892 2.4103 1.0312 1.1067 3.6218 4.3700 3.6432 2.1475 2.6373 3.6268 1.7628 2.3159 1.4369 1.9237 1.7691 1.5687 5.8913 5.2841 2.0637 1.6749 3.2375 1.2330 5.6271 3.4979 1.4827 2.9487 1.3585 5.4959 1.9303 3.7243 2.1184 5.6606 4.3004 3.9689...
output:
159746.4375
result:
ok single line: '159746.4375'
Test #25:
score: 0
Accepted
time: 94ms
memory: 5336kb
input:
100000 2.9997 1.8754 3.6578 3.5640 2.2997 4.8468 2.1478 1.4304 1.2594 1.6387 2.5426 1.8492 3.9057 5.6122 2.0163 4.0944 1.4071 2.3949 3.9905 2.4927 1.8139 4.5202 1.5701 3.6289 3.6385 1.1604 1.0659 5.1477 1.1918 1.7084 3.5747 1.3104 1.9438 4.8863 2.7360 3.4741 3.6282 1.8532 1.6014 5.7858 2.1552 5.0614...
output:
98224.9040
result:
ok single line: '98224.9040'
Test #26:
score: 0
Accepted
time: 111ms
memory: 5404kb
input:
100000 918.8056 823.9854 741.2561 468.2396 101.8532 842.5336 732.7445 172.4660 365.2595 133.5498 436.7877 930.2802 320.8608 526.6234 107.9032 709.8368 290.8174 640.5259 606.1958 723.9234 377.8843 824.8881 596.4760 854.7594 899.2979 793.4743 961.2913 407.2086 975.4593 168.2006 969.4846 213.4524 197.8...
output:
49794505.5526
result:
ok single line: '49794505.5526'