| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 751810 | vjudge1 | Art Exhibition (JOI18_art) | C++14 | 0 ms | 212 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>
#define LL long long
using namespace std;
int main()
{
LL n;
scanf("%lld",&n);
pair<LL,LL>arr[n+5];
for(LL a=1;a<=n;a++)
{
LL x,y;
scanf("%lld %lld",&x,&y);
arr[a]=make_pair(x,y);
}
sort(arr+1,arr+n+1);
bool tama=1;
LL awal,tot=0;
LL maks=0;
for(LL a=1;a<=n;a++)
{
if(a==1)
{
tot+=arr[a].second;
maks=max(maks,tot);
awal=a;
}
else
{
tot+=arr[a].second;
if(tot-abs(arr[a].first-arr[awal].first)<0)
{
tot=arr[a].second;
awal=a;
maks=max(tot,maks);
}
maks=max(tot-(arr[a].first-arr[awal].first),maks);
}
// printf("%lld\n",maks);
}
cout<<tot<<endl;
}
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... | ||||
