답안 #66896

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
66896 2018-08-12T18:29:16 Z Googal Sure Bet (CEOI17_sure) C++14
100 / 100
118 ms 16948 KB
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

const int NMAX = 1e5;

int n;

double res, s1, s2;
double a[1 + NMAX];
double b[1 + NMAX];

int main()
{
  ios::sync_with_stdio(false);

  cin >> n;
  for(int i = 1; i <= n; i++)
    cin >> a[i] >> b[i];

  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);

  int i = n;
  int j = n;

  while(i >= 0 && j >= 0) {
    if(s1 < s2) {
      s1 += a[i];
      i--;
    } else {
      s2 += b[j];
      j--;
    }

    res = max(min(s1, s2) - 2 * n + i + j, res);
  }

  cout << setprecision(4) << fixed;
  cout << res << '\n';
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 548 KB Output is correct
5 Correct 2 ms 548 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 548 KB Output is correct
5 Correct 2 ms 548 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 3 ms 580 KB Output is correct
8 Correct 2 ms 580 KB Output is correct
9 Correct 3 ms 792 KB Output is correct
10 Correct 3 ms 792 KB Output is correct
11 Correct 2 ms 792 KB Output is correct
12 Correct 3 ms 792 KB Output is correct
13 Correct 3 ms 792 KB Output is correct
14 Correct 3 ms 832 KB Output is correct
15 Correct 3 ms 832 KB Output is correct
16 Correct 4 ms 868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 548 KB Output is correct
5 Correct 2 ms 548 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 3 ms 580 KB Output is correct
8 Correct 2 ms 580 KB Output is correct
9 Correct 3 ms 792 KB Output is correct
10 Correct 3 ms 792 KB Output is correct
11 Correct 2 ms 792 KB Output is correct
12 Correct 3 ms 792 KB Output is correct
13 Correct 3 ms 792 KB Output is correct
14 Correct 3 ms 832 KB Output is correct
15 Correct 3 ms 832 KB Output is correct
16 Correct 4 ms 868 KB Output is correct
17 Correct 102 ms 3832 KB Output is correct
18 Correct 109 ms 5336 KB Output is correct
19 Correct 102 ms 6680 KB Output is correct
20 Correct 106 ms 7936 KB Output is correct
21 Correct 113 ms 9664 KB Output is correct
22 Correct 114 ms 11036 KB Output is correct
23 Correct 104 ms 12332 KB Output is correct
24 Correct 118 ms 13752 KB Output is correct
25 Correct 108 ms 15108 KB Output is correct
26 Correct 107 ms 16948 KB Output is correct