Submission #595257

#TimeUsernameProblemLanguageResultExecution timeMemory
595257zxcvbnmArt Exhibition (JOI18_art)C++14
50 / 100
1062 ms20672 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<ll, ll>> a(n); for(auto& i : a) { cin >> i.first >> i.second; } sort(a.begin(), a.end()); ll ans = 0; for(int i = 0; i < n; i++) { ll curr = a[i].second; //cout << a[i].first << " " << a[i].second << "\n"; ans = max(ans, curr); for(int j = i-1; j >= 0; j--) { curr += a[j].second - (a[j+1].first - a[j].first); ans = max(ans, curr); } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...