Submission #365848

#TimeUsernameProblemLanguageResultExecution timeMemory
365848_zheksenovArt Exhibition (JOI18_art)C++14
100 / 100
636 ms21072 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second typedef long long ll; const int N = 5e5 + 5; pair<ll, ll> a[N]; signed main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i].f >> a[i].s; } sort(a, a + n); ll x = a[0].f, y = a[0].s; for (int i = 1; i < n; i++) { a[i].s += a[i - 1].s; x = max(x, a[i].f - a[i - 1].s); y = max(y, a[i].s - a[i].f + x); } cout << y << "\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...