Submission #642667

# Submission time Handle Problem Language Result Execution time Memory
642667 2022-09-20T10:36:54 Z ymm Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3144 KB
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define MAX(x, y) ((x)>(y)?(x):(y))
#define MIN(x, y) ((x)<(y)?(x):(y))

const int N = 100'010;
double a[N], b[N];
int n;

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	cin >> n;
	Loop (i,1,n+1) {
		cin >> a[i] >> b[i];
	}
	sort(a+1, a+n+1); reverse(a+1, a+n+1);
	sort(b+1, b+n+1); reverse(b+1, b+n+1);
	Loop (i,0,n) {
		a[i+1] += a[i];
		b[i+1] += b[i];
	}
	reverse(b, b+n+1);
	double ans = 0;
	Loop (j,0,n+1) {
		double x = 0;
		Loop (i,0,n+1-j)
			x = MAX(x, MIN(a[i], b[j+i]));
		ans = MAX(ans, x - (n - j));
	}
	Loop (i,1,n+1) {
		double x = 0;
		Loop (j,0,n+1-i)
			x = MAX(x, MIN(a[i+j], b[j]));
		ans = MAX(ans, x - (n + i));
	}
	cout << fixed << setprecision(4) << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Execution timed out 2073 ms 3144 KB Time limit exceeded
18 Halted 0 ms 0 KB -