| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1266899 | kutomei3 | Art Exhibition (JOI18_art) | C++20 | 343 ms | 12148 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int mx = 0, ml = 0, sa = 0;
int n;
cin >> n;
int s[n], v[n];
int ind[n];
for (int i = 0; i < n; i++) {
cin >> s[i] >> v[i];
ind[i] = i;
}
sort(ind, ind + n, [&](int i, int j){
return s[i] < s[j];
});
for (int i = 0; i < n; i++) {
mx = max(mx, v[ind[i]]);
mx = max(sa + v[ind[i]] + ml - s[ind[i]], mx);
ml = max(s[ind[i]] - sa, ml);
sa += v[ind[i]];
}
cout << mx;
return 0;
}
/*
pmax - pmin - amax + amin
pmax - amax + amin - p(min - 1)
*/| # | 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... | ||||
