답안 #45081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
45081 2018-04-11T07:10:33 Z qoo2p5 Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 5324 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 1e6 + 123;
const ll LINF = (ll) 1e18 + 1e9 + 123;

#define rep(i, s, t) for (auto i = (s); i < (t); ++(i))
#define per(i, s, t) for (auto i = (s); i >= (t); --(i))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back

bool mini(auto &x, const auto &y) {
	if (y < x) {
		x = y;
		return 1;
	}
	return 0;
}

bool maxi(auto &x, const auto &y) {
	if (y > x) {
		x = y;
		return 1;
	}
	return 0;
}

void run();

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	run();
	return 0;
}

const int N = (int) 1e5 + 123;

int n;
ld a[N], b[N];

void run() {
	cin >> n;
	rep(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);
	rep(i, 1, n + 1) {
		a[i] += a[i - 1];
		b[i] += b[i - 1];
	}
	
	ld ans = 0;
	
	rep(i, 0, n + 1) {
		rep(j, 0, n + 1) {
			maxi(ans, min(a[i], b[j]) - (i + j));
		}
	}
	
	cout << fixed << setprecision(4);
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 652 KB Output is correct
6 Correct 2 ms 652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 652 KB Output is correct
6 Correct 2 ms 652 KB Output is correct
7 Correct 2 ms 652 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 2 ms 780 KB Output is correct
10 Correct 2 ms 780 KB Output is correct
11 Correct 2 ms 780 KB Output is correct
12 Correct 7 ms 780 KB Output is correct
13 Correct 7 ms 868 KB Output is correct
14 Correct 8 ms 868 KB Output is correct
15 Correct 7 ms 868 KB Output is correct
16 Correct 8 ms 948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 400 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 652 KB Output is correct
6 Correct 2 ms 652 KB Output is correct
7 Correct 2 ms 652 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 2 ms 780 KB Output is correct
10 Correct 2 ms 780 KB Output is correct
11 Correct 2 ms 780 KB Output is correct
12 Correct 7 ms 780 KB Output is correct
13 Correct 7 ms 868 KB Output is correct
14 Correct 8 ms 868 KB Output is correct
15 Correct 7 ms 868 KB Output is correct
16 Correct 8 ms 948 KB Output is correct
17 Execution timed out 2061 ms 5324 KB Time limit exceeded
18 Halted 0 ms 0 KB -