Submission #66894

# Submission time Handle Problem Language Result Execution time Memory
66894 2018-08-12T18:28:00 Z Googal Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 248 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(3) << fixed;
  cout << res << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -