# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997123 | 2024-06-11T17:49:59 Z | Luca1234 | Art Exhibition (JOI18_art) | C++14 | 1 ms | 344 KB |
#include <bits/stdc++.h> using namespace std; vector <pair <long long, int> > v; int main() { int n, val; long long sz; cin>>n; for(int i=1; i<=n; i++) { cin>>sz>>val; v.push_back({sz, val}); } sort(v.begin(), v.end()); long long ans=-1e15, aux=-1e15, sum=0; for(int i=0; i<v.size(); i++) { aux=max(aux, v[i].first-sum); sum+=v[i].second; ans=max(ans, sum-v[i].second+aux); } cout<<ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |