제출 #654143

#제출 시각아이디문제언어결과실행 시간메모리
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...