QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#418910 | #4186. Card Trading | zezoo050# | AC ✓ | 37ms | 19696kb | C++20 | 1.0kb | 2024-05-23 16:24:20 | 2024-05-23 16:24:21 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 + 10;
ll buy[N], sell[N];
int n;
void tc() {
cin >> n;
for (int i = 0; i < n; i++) {
string s;
int a, b;
cin >> s >> a >> b;
int num = stod(s) * 100;
buy[num] += a;
sell[num] += b;
}
for (int i = 1; i < N; i++)
sell[i] += sell[i - 1];
for (int i = N - 2; i >= 0; i--)
buy[i] += buy[i + 1];
ll mx = 0;
ll who = -1;
for (int i = 1; i < N; i++) {
if (mx < 1ll * i * min(buy[i], sell[i])) {
mx = 1ll * i * min(buy[i], sell[i]);
who = i;
}
}
if (who == -1)
cout << "impossible\n";
else
cout << fixed << setprecision(2) << (long double) who / 100.0 << ' ' << (long double) mx / 100.0 << '\n';
}
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t = 1;
// cin >> t;
while (t--) {
tc();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 19432kb
input:
5 12.00 0 3 11.99 2 0 11.98 5 0 10.00 1 0 12.01 0 6
output:
impossible
result:
ok
Test #2:
score: 0
Accepted
time: 3ms
memory: 19472kb
input:
6 2.85 14 0 4.50 0 1 5.26 3 3 6.17 1 0 14.78 0 2 21.04 1 0
output:
5.26 21.04
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 19464kb
input:
6 2.85 14 0 4.50 0 1 5.26 2 3 14.78 0 2 1.83 0 1 21.04 1 0
output:
21.04 21.04
result:
ok
Test #4:
score: 0
Accepted
time: 3ms
memory: 19460kb
input:
2 17.10 2 19 29.05 20 11
output:
29.05 581.00
result:
ok
Test #5:
score: 0
Accepted
time: 4ms
memory: 19516kb
input:
5 12.10 5 3 15.00 7 0 16.84 4 0 21.20 1201 0 28.10 3 0
output:
28.10 84.30
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 19468kb
input:
5 5.12 10 2 13.99 0 10 14.02 0 2910 7.12 0 20 10.81 0 12
output:
5.12 10.24
result:
ok
Test #7:
score: 0
Accepted
time: 6ms
memory: 19388kb
input:
100 5106.50 0 420 5647.73 0 140 4384.77 0 323 7.35 441 0 5131.09 0 348 8153.31 0 474 3657.73 0 434 2096.41 190 0 7662.17 0 92 3957.59 0 238 1508.36 466 0 5900.07 0 307 9080.20 0 71 4338.20 0 46 2928.67 0 261 5600.58 0 499 2101.17 426 0 8716.93 0 442 6915.79 0 333 4551.97 0 309 5066.55 0 225 6273.77 ...
output:
impossible
result:
ok
Test #8:
score: 0
Accepted
time: 8ms
memory: 19600kb
input:
200 5171.23 0 122 5808.37 0 371 4190.17 997 0 3293.86 345 0 9817.15 0 705 8863.74 0 878 4995.64 140 0 6618.92 0 303 7090.58 0 858 8446.03 0 418 3236.52 945 0 1458.66 403 0 1104.90 795 0 2780.13 221 0 13.54 124 0 8447.64 0 104 1583.13 563 0 2275.28 90 0 3404.38 681 0 5946.32 0 660 4152.10 94 0 4940.5...
output:
impossible
result:
ok
Test #9:
score: 0
Accepted
time: 6ms
memory: 19620kb
input:
100 7155.14 416 12 163.14 81 166 7962.24 352 1 6825.21 415 435 2090.45 425 288 8119.88 283 295 4277.91 492 334 7693.51 157 402 4657.80 363 193 881.99 355 311 7607.73 217 60 2556.32 121 121 4961.12 4 353 2204.87 133 252 4477.32 24 161 9919.17 137 52 7274.38 391 49 5414.28 304 429 372.51 415 180 3007....
output:
5219.93 62858397.06
result:
ok
Test #10:
score: 0
Accepted
time: 4ms
memory: 19456kb
input:
100 435.27 204 248 9851.84 374 60 6300.48 220 170 3207.77 52 437 1635.81 227 134 4559.56 64 330 1027.98 275 439 3493.54 116 486 8807.16 424 208 6108.91 232 158 6002.40 247 49 6199.99 231 463 7779.28 156 325 1564.84 119 154 8545.27 92 379 6243.03 47 481 6434.01 182 18 630.72 213 193 2227.44 18 37 174...
output:
6002.40 60846328.80
result:
ok
Test #11:
score: 0
Accepted
time: 3ms
memory: 19516kb
input:
100 8162.09 309 134 9465.46 86 286 7802.02 26 28 6105.68 143 294 5029.76 91 276 3078.43 388 32 7355.32 331 255 2093.59 37 357 9587.76 306 249 360.09 81 258 1089.36 104 35 2453.63 70 453 8390.15 127 313 3968.22 126 391 5578.74 454 174 486.23 32 91 952.72 87 152 2991.77 384 142 684.42 290 220 8327.64 ...
output:
5377.50 66664867.50
result:
ok
Test #12:
score: 0
Accepted
time: 29ms
memory: 19456kb
input:
100000 9427.08 1000000 1000000 9919.96 1000000 1000000 9696.73 1000000 1000000 9262.83 1000000 1000000 9849.26 1000000 1000000 9288.06 1000000 1000000 9280.57 1000000 1000000 9820.40 1000000 1000000 9482.02 1000000 1000000 9269.87 1000000 1000000 9764.40 1000000 1000000 9926.93 1000000 1000000 9945....
output:
9500.01 475000500000000.00
result:
ok
Test #13:
score: 0
Accepted
time: 32ms
memory: 19472kb
input:
100000 9521.36 1000000 1000000 9857.50 1000000 1000000 9622.01 1000000 1000000 9879.31 1000000 1000000 9780.70 1000000 1000000 9997.30 1000000 1000000 9957.80 1000000 1000000 9731.46 1000000 1000000 9565.23 1000000 1000000 9040.76 1000000 1000000 9223.91 1000000 1000000 9383.68 1000000 1000000 9551....
output:
9500.01 475000499990499.99
result:
ok
Test #14:
score: 0
Accepted
time: 34ms
memory: 19336kb
input:
100000 8100.28 177034 0 9310.97 527984 0 241.75 6872 0 5430.60 355866 0 1576.32 548637 0 3852.30 315445 0 3162.85 764131 0 4876.30 545848 0 6658.49 834981 0 8963.53 883607 0 2141.19 313112 0 6488.59 109596 0 710.45 418310 0 4450.05 404946 0 3731.22 395678 0 2764.91 168395 0 6752.80 492609 0 5888.60 ...
output:
impossible
result:
ok
Test #15:
score: 0
Accepted
time: 34ms
memory: 19324kb
input:
100000 1879.47 0 302134 3963.70 0 360028 7152.65 0 688302 5628.41 0 53700 5031.24 0 519871 7907.43 0 509564 8996.99 0 855684 3719.79 0 507915 7883.96 0 856773 8864.27 0 880106 7871.66 0 157647 3063.76 0 87006 7614.64 0 862770 5683.00 0 169976 733.64 0 126828 8054.90 0 475639 3946.27 0 417095 1080.13...
output:
impossible
result:
ok
Test #16:
score: 0
Accepted
time: 29ms
memory: 19332kb
input:
100000 3449.44 591717 0 2449.89 7592 0 5272.01 458978 0 4251.82 495411 0 333.27 270344 0 3049.88 398360 0 8033.95 155988 0 8039.56 288033 0 5972.74 158426 0 5040.09 794133 0 499.87 484363 0 6360.09 323817 0 9577.89 0 90040 3669.43 783471 0 3099.39 933075 0 3529.89 63042 0 8073.72 0 102470 2884.01 36...
output:
impossible
result:
ok
Test #17:
score: 0
Accepted
time: 30ms
memory: 19372kb
input:
100000 6412.30 45686 0 1823.17 321422 0 6941.16 0 960477 5273.66 608138 0 8232.16 0 154811 6440.55 51932 0 8834.07 0 58215 5846.29 687638 0 8892.89 0 910951 219.86 541316 0 8944.08 0 349284 4597.47 84761 0 5582.16 985742 0 2970.44 774547 0 2341.78 248927 0 2953.42 637788 0 1792.39 428899 0 7347.47 0...
output:
impossible
result:
ok
Test #18:
score: 0
Accepted
time: 36ms
memory: 19400kb
input:
100000 8201.07 589129 346373 6580.49 207602 525591 1164.01 498115 313953 7099.19 649361 5517 8832.82 466961 709462 8175.00 84306 30031 9503.61 398194 649045 5552.76 320923 518631 1882.02 172958 321889 2500.37 833505 643199 7071.56 184097 350001 6791.04 720519 208531 3413.96 692595 321747 8793.64 753...
output:
4992.95 124641357526514.10
result:
ok
Test #19:
score: 0
Accepted
time: 37ms
memory: 19496kb
input:
100000 660.65 503632 535239 695.25 505075 184865 4483.69 90468 217526 2360.25 917940 637215 1043.93 434527 536039 3591.14 924537 222540 163.57 744282 700806 6972.17 877897 864990 779.11 948768 128214 1014.76 379856 53113 5249.16 232628 762006 8849.82 858968 597265 7245.58 862832 289425 9830.27 50189...
output:
5112.91 125184401684143.12
result:
ok
Test #20:
score: 0
Accepted
time: 33ms
memory: 19404kb
input:
100000 2127.15 762439 392317 7031.17 218124 250896 6845.34 682798 852944 2961.49 362211 198791 7754.28 833577 112706 8981.76 553753 422497 9048.24 846269 614494 6348.03 115976 348122 2619.78 284286 246747 4407.56 654338 557710 338.62 558718 948736 5511.84 906893 154265 8139.19 399433 879330 7864.95 ...
output:
4984.60 124743567648231.20
result:
ok
Test #21:
score: 0
Accepted
time: 37ms
memory: 19696kb
input:
100000 153.02 193634 300389 4403.25 158048 659527 3880.10 652594 941990 5389.53 442190 989853 3599.89 747788 981468 7000.71 971142 154794 6521.92 681455 661428 6378.65 230591 78381 2185.52 261099 282408 2233.60 747598 267955 6170.54 554827 708351 2114.63 601988 826894 8555.86 747004 677809 5187.64 3...
output:
5023.77 125685485576716.83
result:
ok
Test #22:
score: 0
Accepted
time: 34ms
memory: 19472kb
input:
100000 6309.57 586489 467027 2623.10 127244 926512 5302.16 612442 737396 5482.92 781600 260248 4961.51 324113 40831 9509.36 246482 255726 7467.17 226978 437295 1442.66 976284 556991 2111.12 691126 200589 2266.94 926549 248747 2947.01 952876 998388 4106.58 8080 282575 5683.26 737266 608595 1471.76 62...
output:
5113.87 124840893681698.11
result:
ok