# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
718477 | shoryu386 | Art Exhibition (JOI18_art) | C++17 | 1050 ms | 17304 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 int long long
main(){
int n; cin >> n;
pair<int, int> szVal[n];
for (int x = 0; x < n; x++) cin >> szVal[x].first >> szVal[x].second;
sort(szVal, szVal+n);
int l = 0, r = 0;
int psum[n]; psum[0] = szVal[0].second;
for (int x = 1; x < n; x++) psum[x] = psum[x-1] + szVal[x].second;
int ans = LONG_LONG_MIN;
for (int x = 0; x < n; x++){
for (int y = x; y < n; y++){
int sm = psum[y] - (szVal[y].first - szVal[x].first);
if (x != 0) sm -= psum[x-1];
ans = max(ans, sm);
}
}
cout << ans;
}
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... |