Submission #385189

#TimeUsernameProblemLanguageResultExecution timeMemory
385189AzimjonArt Exhibition (JOI18_art)C++17
50 / 100
1082 ms25060 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pair<int, int>> a(n); for (auto &[x, y] : a) { cin >> x >> y; } sort(a.begin(), a.end()); vector<int> p({0}); for (auto [x, y] : a) { p.push_back(p.back() + y); } int jv = -1; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { jv = max(jv, p[j + 1] - p[i] - (a[j].first - a[i].first)); } } cout << jv << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...