# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
728347 | viwlesxq | Art Exhibition (JOI18_art) | C++17 | 1063 ms | 28580 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;
typedef int64_t ll;
typedef string str;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector <pair <ll, ll>> v;
ll a[n], b[n];
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
v.push_back({a[i], b[i]});
}
sort(v.begin(), v.end());
for (int i = 0; i < n; ++i) {
a[i] = v[i].first;
b[i] = v[i].second;
}
ll ans = -1;
for (int i = 0; i < n; ++i) {
ll S = 0;
for (int j = i; j < n; ++j) {
S += b[j];
ans = max(ans, S - (a[j] - a[i]));
}
# | 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... |