| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1329901 | rishad164 | Art Exhibition (JOI18_art) | C++20 | 127 ms | 12184 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, bs = -9999999;
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());
for (ll i = 0; i < n; i++) {
ll size = a[i].first;
ll value = a[i].second;
bs = max( bs + value, size + value);
maxv = max(maxv, bs - size);
}
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... | ||||
