# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1028171 |
2024-07-19T14:48:52 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
66 ms |
5212 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<ld> a(n), b(n);
for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
ld paid = 0;
ld currA = 0;
ld currB = 0;
ld ans = 0;
while(!((currA <= currB && a.empty()) || (currA > currB && b.empty()))){
paid++;
if(currA <= currB){
currA += a.back();
a.pop_back();
}else{
currB += b.back();
b.pop_back();
}
ans = max(ans, min(currA, currB) - paid);
}
cout << fixed << setprecision(4) << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
500 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
500 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
516 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
63 ms |
4872 KB |
Output is correct |
18 |
Correct |
59 ms |
4944 KB |
Output is correct |
19 |
Correct |
62 ms |
4696 KB |
Output is correct |
20 |
Correct |
63 ms |
4944 KB |
Output is correct |
21 |
Correct |
62 ms |
5212 KB |
Output is correct |
22 |
Correct |
60 ms |
4956 KB |
Output is correct |
23 |
Correct |
60 ms |
4948 KB |
Output is correct |
24 |
Correct |
60 ms |
4956 KB |
Output is correct |
25 |
Correct |
59 ms |
4944 KB |
Output is correct |
26 |
Correct |
66 ms |
5116 KB |
Output is correct |