제출 #1126489

#제출 시각아이디문제언어결과실행 시간메모리
1126489vladiliusSure Bet (CEOI17_sure)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; vector<double> a(n + 1), b(n + 1); for (int i = 1; i <= n; i++){ cin>>a[i]; } for (int i = 1; i <= n; i++){ cin>>b[i]; } sort(a.begin() + 1, a.end(), greater<double>()); sort(b.begin() + 1, b.end(), greater<double>()); for (int i = 1; i <= n; i++){ a[i] += a[i - 1]; b[i] += b[i - 1]; } double out = 0; for (int i = 1; i <= n; i++){ for (int j = 1; j <= n; j++){ out = max(out, min(a[i], b[j]) - (i + j)); } } printf("%.4lf", out); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...