답안 #879259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879259 2023-11-27T04:45:59 Z vjudge1 Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 2396 KB
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;

using ld = long double;

const int N = 1e5 + 123;

ld a[N], b[N];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	for (int i = 1 ; i <= n ; ++ i) cin >> a[i];
	for (int i = 1 ; i <= n ; ++ i) cin >> b[i];
	sort(a + 1, a + 1 + n);
	sort(b + 1, b + 1 + n);
	reverse(a + 1, a + 1 + n);
	reverse(b + 1, b + 1 + n);
	for (int i = 1 ; i <= n ; ++ i) a[i] += a[i - 1], b[i] += b[i - 1];
	ld ans = -(1e18);
	for (int i = 0 ; i <= n ; ++ i) {
		for (int j = 0 ; j <= n ; ++ j) {
			ld cur = min(a[i], b[j]) - (i + j);
			ans = max(ans, cur);
		}
	}
	cout << fixed << setprecision(4);
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 1 ms 2396 KB Output isn't correct
4 Halted 0 ms 0 KB -