# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973853 | 2024-05-02T11:54:35 Z | Hectorungo_18 | Art Exhibition (JOI18_art) | C++14 | 0 ms | 348 KB |
#include <iostream> #include <bits/stdc++.h> #include <list> #include <set> #include <cstdio> using namespace std; #define int unsigned long long #define f first #define s second #define all(x) x.begin(), x.end() void solve(){ int n; cin >> n; vector<pair<int, int>> v(n); for(int i = 0; i < n; i++) cin >> v[i].f >> v[i].s; sort(all(v)); int ans = v[0].s; int bf = v[0].f; int cur = v[0].s; for(int i = 1; i < n; i++){ int ad = v[i].s; int re = v[i].f-v[i-1].f; if(cur+ad-re < 0){ cur = ad; ans = max(ans, cur); continue; } cur+=ad-re; ans=max(ans, cur); } cout << ans << endl; } signed main() { int t = 1; // cin >> t; while(t--) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |