| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 954487 | mocha | Sure Bet (CEOI17_sure) | C++14 | 94 ms | 6732 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5+5;
int n;
long double a[mx], b[mx];
long double ans = 0;
long double sa = 0;
long double d[mx];
int main() {
cin.tie(0);ios::sync_with_stdio(0);
cin >> n;
for (int i=0;i<n;i++) {
cin >> a[i] >> b[i];
}
sort(a, a+n); reverse(a, a+n);
sort(b, b+n); reverse(b, b+n);
d[0] = b[0];
for (int i=1;i<n;i++) {
d[i] = d[i-1] + b[i];
}
for (int i=0;i<n;i++) {
sa += a[i];
if (a[i] <= 1) break;
long double sb = 0;
// for (int j=0;j<n;j++) {
// cout << sa - i - j - 2 << " ";
// }
// cout << "\n";
int lc = 0, rc = n-1;
while (lc < rc) {
int m = lc + rc >> 1;
if ((sa - i - m - 2) < (d[m] - i - m - 2)) {
rc = m;
} else {
lc = m+1;
}
}
// cout << lc << " ";
long double tmp;
tmp = min(sa - i - lc - 2, d[lc] - i - lc - 2);
if ( lc != 0 ) {
tmp = max(tmp, min(sa - i - lc - 1, d[lc-1] - i - lc - 1));
}
ans = max(ans, tmp);
}
// cout << "\n";
cout << fixed << setprecision(4) << 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... | ||||
