Submission #699650

#TimeUsernameProblemLanguageResultExecution timeMemory
699650MohammadAbduljalilArt Exhibition (JOI18_art)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #define fast_input_output() ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr) typedef long long ll; using namespace std; int main() { fast_input_output(); ll n; cin >> n; vector<pair<ll, ll>> v(n); for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second; sort(v.begin(), v.end()); ll ans[n]; ans[0] = v[0].second; for (int i = 1; i < n; i++) { ll x = ans[i-1] + v[i-1].first - v[i].first + v[i].second; ans[i] = max(ans[i-1], x); } cout << ans[n-1]; 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...