Submission #1264542

#TimeUsernameProblemLanguageResultExecution timeMemory
1264542happyboyArt Exhibition (JOI18_art)C++20
100 / 100
327 ms8244 KiB
#include <bits/stdc++.h> int main() { int n; std :: cin >> n; std :: vector<std::pair<long long, long long>> ab(n); for (auto &[a, b] : ab) std :: cin >> a >> b; std :: sort(ab.begin(), ab.end()); long long pmx = INT64_MIN, tot = 0LL, ans = INT64_MIN; for (auto [a, b] : ab) { pmx = std :: max(pmx, a - tot); tot += b; ans = std :: max(ans, tot - a + pmx); } std :: 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...