Submission #996225

#TimeUsernameProblemLanguageResultExecution timeMemory
996225faqinyeagerArt Exhibition (JOI18_art)C++17
10 / 100
4 ms440 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int n; vector<ll> a, b; int main(){ cin >> n; a.resize(n); b.resize(n); for(int i = 0; i < n; i++) cin >> a[i] >> b[i]; ll ans = 0; for(int i = 1; i < (1 << n); i++){ ll cur = 0, mn = 1e15, mx = 0; for(int j = 0; j < n; j++){ if(i >> j & 1){ cur += b[j]; mn = min(mn, a[j]); mx = max(mx, a[j]); } } ans = max(ans, cur - mx + mn); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...