# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
516301 | Jomnoi | Art Exhibition (JOI18_art) | C++17 | 1 ms | 204 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>
#define DEBUG 0
using namespace std;
int main() {
int n;
cin >> n;
vector <pair <long long, int>> vec;
for(int i = 1; i <= n; i++) {
long long a;
int b;
scanf(" %lld %d", &a, &b);
vec.emplace_back(a, b);
}
sort(vec.begin(), vec.end());
long long ans = vec[0].second - vec[0].first, sum = vec[0].second;
for(int i = 1; i < n; i++) {
sum += vec[i].second;
ans = max(ans, sum - vec[i].first + vec[0].first);
}
cout << 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... |