QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#421331 | #2771. Need for Speed | Kripton# | AC ✓ | 1ms | 3940kb | C++17 | 1.3kb | 2024-05-25 16:37:44 | 2024-05-25 16:37:46 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define ll long long
#define x first
#define y second
#define pii pair<int, int>
#define int long long
#define ld long double
#define lsb(x) ((x) & (-(x)))
using namespace std;
mt19937 gen(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count());
uniform_int_distribution<int> rng;
normal_distribution <double> rng_d(-1, 1);
pii v[1005];
void solve() {
int t, n;
cin >> n >> t;
int mn = 1e9;
for(int i = 1; i <= n; i++) {
cin >> v[i].x >> v[i].y;
mn = min(mn, v[i].y);
}
ld st = -mn + 1e-7, dr = 1e9, mid;
while(dr - st > 1e-7) {
mid = (st + dr) / 2;
ld tot = 0;
for(int i = 1; i <= n; i++)
tot += 1.0 * v[i].x / (mid + v[i].y);
if(tot < t)
dr = mid;
else
st = mid;
}
cout << fixed << setprecision(10) << st;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#else
#endif
int T = 1;
//cin >> T;
while(T--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
3 5 4 -1 4 0 10 3
output:
2.9999999859
result:
ok found '3.0000000', expected '3.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
4 10 5 3 2 2 3 6 3 1
output:
-0.5086533805
result:
ok found '-0.5086534', expected '-0.5086534', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
1 500 123 456
output:
-455.7540000117
result:
ok found '-455.7540000', expected '-455.7540000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
3 1 1 2 1 3 1 6
output:
-0.0000000081
result:
ok found '-0.0000000', expected '-0.0000000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
4 10 1 -1 2 -2 3 -3 4 -5
output:
5.4996198875
result:
ok found '5.4996199', expected '5.4996199', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
100 100001 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 1 1000 1 1000 1 1000 1 1000 1 10...
output:
-0.0000100303
result:
ok found '-0.0000100', expected '-0.0000100', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
100 99001 1000 999 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 1 1000 1 1000 1 1000 1 1...
output:
-0.0000000383
result:
ok found '-0.0000000', expected '0.0000000', error '0.0000000'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3940kb
input:
1000 300 408 -17 943 -93 4 706 172 -343 472 -812 888 -669 507 -655 117 -324 209 -639 370 142 608 192 521 852 460 -269 93 56 821 -671 141 -240 190 574 608 79 681 295 742 123 954 91 194 -854 759 -807 639 593 901 147 877 740 492 216 498 985 884 -202 229 -982 261 -887 166 255 464 893 50 -63 664 -344 276...
output:
1838.0345692943
result:
ok found '1838.0345693', expected '1838.0345693', error '0.0000000'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
1000 1 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1...
output:
1000999.9999999607
result:
ok found '1001000.0000000', expected '1001000.0000000', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
1 1000000 1 1000
output:
-999.9999990118
result:
ok found '-999.9999990', expected '-999.9999990', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
68 213437 121 251 678 -919 864 -19 686 929 221 -727 207 -78 169 960 730 592 998 163 728 -248 164 -332 265 898 958 -943 151 -741 252 -68 532 -911 345 105 872 640 694 99 228 564 775 -586 695 -647 210 -897 488 553 198 838 657 -763 772 19 87 662 121 648 767 -106 130 395 566 -183 90 866 273 -568 896 -766...
output:
943.0044905593
result:
ok found '943.0044906', expected '943.0044906', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
770 921161 391 785 963 768 968 97 708 890 232 319 603 695 648 282 669 265 855 131 873 173 743 479 204 297 524 748 340 671 275 57 229 689 429 909 366 162 813 144 701 33 196 521 518 279 763 442 865 582 315 259 579 583 878 408 73 297 123 784 794 54 120 474 142 753 538 946 681 442 235 457 746 187 576 61...
output:
-0.9982661202
result:
ok found '-0.9982661', expected '-0.9982661', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
743 309408 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 1000 1 1000 1000 ...
output:
0.2037390431
result:
ok found '0.2037390', expected '0.2037391', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
387 51137 1 1000 2 999 3 998 4 997 5 996 6 995 7 994 8 993 9 992 10 991 11 990 12 989 13 988 14 987 15 986 16 985 17 984 18 983 19 982 20 981 21 980 22 979 23 978 24 977 25 976 26 975 27 974 28 973 29 972 30 971 31 970 32 969 33 968 34 967 35 966 36 965 37 964 38 963 39 962 40 961 41 960 42 959 43 9...
output:
-613.9921019351
result:
ok found '-613.9921019', expected '-613.9921019', error '0.0000000'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
880 3 211 -1000 98 -999 8 -998 897 -997 521 -996 567 -995 328 -994 838 -993 992 -992 54 -991 982 -990 83 -989 458 -988 752 -987 780 -986 699 -985 619 -984 228 -983 402 -982 648 -981 768 -980 837 -979 884 -978 743 -977 808 -976 701 -975 666 -974 520 -973 915 -972 285 -971 349 -970 977 -969 23 -968 88...
output:
145753.2037210539
result:
ok found '145753.2037211', expected '145753.2037210', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
1 1000000 1 -1000
output:
1000.0000009882
result:
ok found '1000.0000010', expected '1000.0000010', error '0.0000000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 10 7 10 7 10
output:
-8.6000000477
result:
ok found '-8.6000000', expected '-8.6000000', error '0.0000000'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
1000 1 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 100...
output:
998999.9999999617
result:
ok found '999000.0000000', expected '999000.0000004', error '0.0000000'