# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
504997 | Andy__Andy__ | Art Exhibition (JOI18_art) | C++17 | 1066 ms | 24588 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
#define int ll
using namespace std;
ifstream f ("test.in");
ofstream g ("test.out");
pair < int ,int > v[500005];
int sum[500005];
main()
{
int n,k;
cin>>n;
for(int i=1;i<=n;++i)
{
int valoare ,marime;
cin>>marime >> valoare;
v[i]={marime,valoare};
}
sort(v+1,v+1+n);
for(int i=1;i<=n;++i) sum[i] = sum[i-1] + v[i].second;
int ans = 0;
for(int i=1;i<=n;++i)
{
for(int j=i;j<=n;++j)
{
int tmp = sum[j] - sum[i-1] - v[j].first + v[i].first;
ans = max(ans, tmp);
}
}
cout<<ans;
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... |