| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 699191 | TAhmed33 | Art Exhibition (JOI18_art) | C++98 | 1074 ms | 20624 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
bool compare (pair <int, int> a, pair <int, int> b) {
return (a.first <= b.first);
}
signed main () {
int n;
cin >> n;
pair <int, int> arr[n];
for (auto &i : arr) cin >> i.first >> i.second;
sort(arr, arr + n, compare);
int ans = 0;
for (int i = 0; i < n; i++) {
int sum = 0;
int mx = -1e18;
int mn = 1e18;
for (int j = i; j < n; j++) {
mx = max(mx, arr[j].first);
mn = min(mn, arr[j].first);
sum += arr[j].second;
ans = max(ans, sum - (mx - mn));
}
}
cout << ans << endl;
}| # | 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... | ||||
