| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1349298 | khanhphucscratch | Sure Bet (CEOI17_sure) | C++20 | 1 ms | 348 KiB |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n; cin>>n;
vector<double> a, b;
for(int i = 1; i <= n; i++){
double x, y; cin>>x>>y;
a.push_back(x); b.push_back(y);
}
sort(a.begin(), a.end()); sort(b.begin(), b.end());
double ans = 0, x = 0, y = 0;
if(a.back() > b.back()) swap(a, b);
for(int i = 1; i <= 2*n; i++){
if(x < y && a.size() > 0){
x += a.back(); a.pop_back();
}
else{
y += b.back(); b.pop_back();
}
ans = max(ans, min(x, y) - i);
}
cout<<setprecision(4)<<fixed<<ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
