Submission #385490

#TimeUsernameProblemLanguageResultExecution timeMemory
385490AzimjonArt Exhibition (JOI18_art)C++17
100 / 100
246 ms20972 KiB
// Muallif: Azimjon Mehmonali o'g'li #include <bits/stdc++.h> using namespace std; #define int long long const long double PI = 3.1415926535897; const int mod = 1000000007LL; const int INF = 1e18; signed main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<pair<int, int>> v(n); for (auto &[x, y] : v) { cin >> x >> y; } sort(v.begin(), v.end()); int jv, ki, yi; jv = ki = yi = 0; for (int i = 0; i < n; i++) { ki = min(ki, yi - v[i].first); yi += v[i].second; jv = max(jv, yi - v[i].first - ki); } cout << jv << endl; 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...