# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
366243 | Tuk1352 | Art Exhibition (JOI18_art) | C++11 | 0 ms | 364 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;
int main ()
{
int n;
cin >> n;
long long A, S, MS=0, Su=0, Sd, I=0;
vector <pair<long long, long long>> V;
for (int i = 0; i < n; i++)
{
cin >> A >> S;
V.push_back({A, S});
}
sort(V.begin(), V.end());
for (int i = 0; i < V.size(); i++)
{
Su += V[i].second;
Sd = Su - (V[i].first - V[I].first);
while (Sd < 0)
{
Su -= V[I].second;
I++;
Sd = Su - (V[i].first - V[I].first);
}
MS = max(MS, Sd);
}
cout << MS;
return 0;
}
Compilation message (stderr)
# | 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... |