# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
314223 | radaiosm7 | Art Exhibition (JOI18_art) | C++98 | 1 ms | 384 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;
int n, i;
long long ans, curr;
pair<long long, long long> numbers[500005];
int main() {
scanf("%d", &n);
for (i=0; i < n; i++) {
scanf("%lld%lld", &numbers[i].first, &numbers[i].second);
}
sort(numbers, numbers+n);
ans = numbers[0].second;
curr = ans;
for (i=1; i < n; i++) {
curr += numbers[i-1].first - numbers[i].first;
curr += numbers[i].second;
ans = max(curr, ans);
}
printf("%lld\n", ans);
return 0;
}
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... |