Submission #161343

#TimeUsernameProblemLanguageResultExecution timeMemory
161343jovan_bArt Exhibition (JOI18_art)C++17
100 / 100
339 ms20948 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; pair <ll, ll> niz[500005]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed; int n; cin >> n; for(int i=1; i<=n; i++){ cin >> niz[i].first >> niz[i].second; } sort(niz+1, niz+1+n); ll res = 0; ll sum = 0; for(int i=1; i<=n; i++){ sum += niz[i].second; res = max(res, sum); sum += niz[i].first - niz[i+1].first; sum = max(0LL, sum); } cout << res; 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...