Submission #583319

# Submission time Handle Problem Language Result Execution time Memory
583319 2022-06-25T08:33:34 Z 600Mihnea Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 7964 KB
#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

signed main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  ///freopen ("input.txt", "r", stdin);

  int n;
  cin >> n;
  vector<ld> s1(n + 1, 0), s2(n + 1, 0);
  {
    vector<ld> a(n), b(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i] >> b[i];
    }
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());

    for (int i = 0; i < n; i++) {
      s1[i + 1] = s1[i] + a[i];
      s2[i + 1] = s2[i] + b[i];
    }
  }

  ld sol = 0;

  for (int t1 = 0; t1 <= n; t1++) {
    for (int t2 = 0; t2 <= n; t2++) {
      sol = max(sol, min(s1[t1], s2[t2]) - t1 - t2);
    }
  }
  cout << fixed << setprecision(4) << sol << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 6 ms 332 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 5 ms 404 KB Output is correct
15 Correct 6 ms 340 KB Output is correct
16 Correct 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 6 ms 332 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 5 ms 404 KB Output is correct
15 Correct 6 ms 340 KB Output is correct
16 Correct 6 ms 340 KB Output is correct
17 Execution timed out 2079 ms 7964 KB Time limit exceeded
18 Halted 0 ms 0 KB -