| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 846549 | QwertyPi | Sure Bet (CEOI17_sure) | C++14 | 1 ms | 356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int32_t main(){
int n; cin >> n;
vector<double> a, b;
for(int i = 0; i < n; i++){
int v; cin >> v; a.push_back(v);
}
for(int i = 0; i < n; i++){
int v; cin >> v; b.push_back(v);
}
sort(a.begin(), a.end(), [](int x, int y){ return x > y; });
sort(b.begin(), b.end(), [](int x, int y){ return x > y; });
vector<double> sa(n + 1), sb(n + 1);
for(int i = 0; i < n; i++) sa[i + 1] = sa[i] + a[i];
for(int i = 0; i < n; i++) sb[i + 1] = sb[i] + b[i];
int L = 0, R = 0;
double ans = 0;
while(L < n || R < n){
if(R == n || L < n && sa[L] < sb[R]) L++;
else R++;
ans = max(ans, min(sa[L], sb[R]) - (L + R));
}
cout << fixed << setprecision(4) << ans << endl;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
