# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
938286 |
2024-03-05T04:12:08 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define int long long
const int N = 2e5;
const int mod = 1e9 + 7;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vector<long double> a(n), b(n);
for(auto &e : a) cin >> e;
for(auto &e : b) cin >> e;
long double ans = 0.0;
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
long double s = 0, s1 = 0, cnt = 0;
int i = 0, j = 0;
while(true){
while(i < n && s-cnt < s1-cnt){
s+= a[i];
i++, cnt++;
ans = max(ans, min(s, s1) - cnt);
}
if(j < n){
s1+= b[j];
cnt++, j++;
ans = max(ans, min(s, s1) - cnt);
}
if(j == n + 1) break;
if(j == n) j++;
}
cout << fixed << setprecision(4);
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |