| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1329894 | rishad164 | Art Exhibition (JOI18_art) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
#define NL '\n'
#define ll long long int
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll n, maxv = -99999999, s = 0;
cin >> n;
vector <pair <ll, ll >> a(n);
vector <ll> b(n);
for (ll i = 0; i < n; i++) {
cin >> a[i].first;
cin >> a[i].second;
}
sort (a.begin(), a.end());
s = a[0].second;
for (ll i = 1; i < n; i++) {
if ((s + a[i].second) - (a[i].first - a[0].first) > maxv) {
s += a[i].second;
maxv = s - (a[i].first - a[0].first);
}
}
cout << maxv;
return 0;
}
/*
2 3
4 5
11 2
*/| # | 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... | ||||
