Submission #879269

#TimeUsernameProblemLanguageResultExecution timeMemory
879269vjudge1Sure Bet (CEOI17_sure)C++17
0 / 100
0 ms2396 KiB
#include <iostream> #include <algorithm> #include <iomanip> using namespace std; using ld = double; const int N = 1e6 + 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 = 2 ; i <= n ; ++ i) a[i] += a[i - 1], b[i] += b[i - 1]; ld ans = 0; for (int i = 1 ; i <= n ; ++ i) { for (int j = 1 ; j <= n ; ++ j) { ld cur = min(a[i], b[j]) - (i + j); ans = max(ans, cur); } } printf("%.4lf\n", ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...