# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
330794 | M_W | Art Exhibition (JOI18_art) | C++14 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ii pair<long long, long long>
ii a[500500];
int main(){
int N;
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%lld %lld", &a[i].first, &a[i].second);
}
sort(a, a + N);
long long curmax = a[0].second, maxmax = a[0].second;
for(int i = 1; i < N; i++){
curmax += a[i].second - (a[i].first - a[i - 1].first);
if(curmax < 0) curmax = a[i].second;
maxmax = max(maxmax, curmax);
}
printf("%lld", maxmax);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |