| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1349312 | khanhphucscratch | Sure Bet (CEOI17_sure) | C++20 | 0 ms | 344 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 = -1e9, 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... | ||||
