| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1313070 | Agageldi | Art Exhibition (JOI18_art) | C++20 | 1094 ms | 8236 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define N 500005
#define f first
#define s second
int tc = 1, n, ans = LLONG_MIN;
pair <int,int> a[N];
int32_t main() {
ios::sync_with_stdio(0);cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> a[i].f >> a[i].s;
}
sort(a+1,a+n+1);
for(int i =1; i <= n; i++) {
int mn = a[i].f,mx = a[i].f, sum = 0;
for(int j = i;j >= 1; j--) {
sum += a[j].s;
mn = min(a[j].f,mn);
mx = max(mx,a[j].f);
ans = max(ans,sum - mx + mn);
}
}
cout << ans << '\n';
return 0;
}| # | 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... | ||||
