Submission #654143

#TimeUsernameProblemLanguageResultExecution timeMemory
654143lunchbox1Art Exhibition (JOI18_art)C++17
0 / 100
1 ms212 KiB
/* author: lunchbox problem link: https://oj.uz/problem/view/JOI18_art */ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int n; cin >> n; vector<pair<long long, int>> a(n); for (auto &[x, y] : a) cin >> x >> y; sort(a.begin(), a.end()); long long ans = 0, pre = 1e18, cur = 0; for (auto [x, y] : a) { ans = max(ans, cur - x + y - pre); pre = min(pre, cur - x), cur += y; } cout << ans << '\n'; 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...