# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
272132 | 2020-08-18T09:41:39 Z | Halit | Art Exhibition (JOI18_art) | C++17 | 1 ms | 288 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){ if(sum < v[i].first - v[i - (i != j)].first){ j = i; sum = 0; } sum += v[i].second; ans = max(ans,sum - (v[i].first - v[j].first)); } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 288 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 1 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 288 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 1 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 288 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 1 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 288 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 1 ms | 256 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |