Submission #202947

#TimeUsernameProblemLanguageResultExecution timeMemory
202947AlexPop28Art Exhibition (JOI18_art)C++11
0 / 100
5 ms376 KiB
#include <bits/stdc++.h> #define dbg() cerr << #define name(x) (#x) << ": " << (x) << ' ' << using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<pair<long long, int>> v(n); for (auto &p : v) { cin >> p.first >> p.second; } sort(v.begin(), v.end()); long long ans = numeric_limits<long long>::min(); long long s = 0; for (int i = 0; i < n; ++i) { s += v[i].second; long long curr = s - (v[i].first - v[0].first); ans = max(ans, curr); } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...