# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
56085 | 2018-07-09T22:02:45 Z | gabrielsimoes | Sure Bet (CEOI17_sure) | C++17 | 2000 ms | 600 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5+10; int n; vector<double> va, vb; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { double a, b; scanf("%lf %lf", &a, &b); va.push_back(a); vb.push_back(b); } sort(va.rbegin(), va.rend()); sort(vb.rbegin(), vb.rend()); for (int i = 1; i < n; i++) { va[i] += va[i-1]; vb[i] += vb[i-1]; } va.insert(va.begin(), 0); vb.insert(vb.begin(), 0); double ans = 0; for (int i = 0; i <= n; i++) { int l = 0, r = n; while (r - l > 100) { int m1 = l + (l + r)/3; int m2 = l + 2 * ((l + r)/3); double v1 = min(va[i] - (i + m1), vb[m1] - (i + m1)); double v2 = min(va[i] - (i + m2), vb[m2] - (i + m2)); if (v1 > v2) r = m2-1; else l = m1+1; } for (int k = l; k <= r; k++) { ans = max(ans, min(va[i] - (i+k), vb[k] - (i+k))); } } printf("%.4lf\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 484 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 484 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 484 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 484 KB | Output is correct |
7 | Correct | 3 ms | 500 KB | Output is correct |
8 | Correct | 3 ms | 600 KB | Output is correct |
9 | Correct | 2 ms | 600 KB | Output is correct |
10 | Correct | 2 ms | 600 KB | Output is correct |
11 | Correct | 3 ms | 600 KB | Output is correct |
12 | Execution timed out | 2073 ms | 600 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 484 KB | Output is correct |
4 | Correct | 3 ms | 484 KB | Output is correct |
5 | Correct | 3 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 484 KB | Output is correct |
7 | Correct | 3 ms | 500 KB | Output is correct |
8 | Correct | 3 ms | 600 KB | Output is correct |
9 | Correct | 2 ms | 600 KB | Output is correct |
10 | Correct | 2 ms | 600 KB | Output is correct |
11 | Correct | 3 ms | 600 KB | Output is correct |
12 | Execution timed out | 2073 ms | 600 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |