# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
272094 | 2020-08-18T08:56:53 Z | Halit | Art Exhibition (JOI18_art) | C++17 | 0 ms | 256 KB |
#include <bits/stdc++.h> #define max(xx,yy) (xx > yy ? xx : yy) #define min(xx,yy) (xx > yy ? yy : xx) #define all(x) x.begin(), x.end() using namespace std; int main(){ int n; scanf("%d", &n); vector< pair<long long, long long> > v; for(int i = 0;i < n;++i){ long long a,b; scanf("%lld %lld", &a, &b); v.emplace_back(a,b); } sort(all(v)); long long sum = 0, j = 0, ans = 0; for(int i = 0;i < n;++i){ sum += v[i].second; if(sum - (v[i].first - v[j].first) < 0){ j = i+1; sum = 0; } else{ ans = max(ans,sum - (v[i].first - v[j].first)); } } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |