| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 654732 | pauloamed | Sure Bet (CEOI17_sure) | C++14 | 94 ms | 6040 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ld double
vector<ld> sa, sb;
ld ternary_search(int lo, int hi, ld a, int b) {
auto f = [&](int j){
return min(sb[j], a) - (b + j + 1);
};
while (hi - lo > 1){
int mid = (hi + lo)>>1;
if (f(mid) > f(mid + 1))
hi = mid;
else
lo = mid;
}
return f(lo + 1);
}
int32_t main(){
cin.tie(NULL)->sync_with_stdio(false);
int n; cin >> n;
vector<ld> a, b;
for(int i = 0; i < n; ++i){
ld x, y; cin >> x >> y;
a.push_back(x);
b.push_back(y);
}
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
for(int i = 0; i < n; ++i){
sa.push_back(a[i]);
sb.push_back(b[i]);
if(i){
sa[i] += sa[i - 1];
sb[i] += sb[i - 1];
}
}
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
ld x = min(sa[i], sb[j]);
int y = i + j + 2;
}
}
ld ans = 0;
for(int i = 0; i < n; ++i){
ans = max(ans, ternary_search(-1, n, sa[i], (i + 1)));
}
cout << setprecision(4) << fixed << ans << "\n";
}컴파일 시 표준 에러 (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... | ||||
