Submission #255637

#TimeUsernameProblemLanguageResultExecution timeMemory
255637Haunted_CppSure Bet (CEOI17_sure)C++17
60 / 100
2075 ms3320 KiB
/** * author: Haunted_Cpp **/ #include <bits/stdc++.h> using namespace std; #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loops") template<typename T> ostream &operator << (ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; } template<typename T, size_t size> ostream &operator << (ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; } template<typename A, typename B> ostream &operator << (ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } void debug_out() { cerr << endl; } template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); } #ifdef LOCAL #define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__) #else #define debug(...) 47 #endif const int MAX_N = 1e3 + 5; vector<double> a, b; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; a.resize(n); b.resize(n); for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a.rbegin(), a.rend()); sort(b.rbegin(), b.rend()); double mx = 0; double res_a = 0; for (int i = 0; i <= n; i++) { if (i) res_a += a[i - 1]; double res_b = 0; for (int j = 0; j <= n; j++) { if(j) res_b += b[j - 1]; mx = max(mx, min(res_a, res_b) - i - j); } } cout << fixed << setprecision(4) << mx << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...