# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
710839 | Jovan26 | Art Exhibition (JOI18_art) | C++14 | 1099 ms | 45924 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(){
#define int long long
int n;
cin>>n;
int a1[n];
int b[n];
map<int, int> mapa;
for(int i=0;i<n;i++){
cin>>a1[i]>>b[i];
mapa[a1[i]]+=b[i];
}
sort(a1,a1+n);
vector<int> a;
for(int i=0;i<n;i++){
if(i==0 || a1[i]!=a1[i-1]) a.push_back(a1[i]);
}
int o = 0;
for(int i=0;i<a.size();i++){
//if(i!=0 && a[i]==a[i-1]) continue;
int maks = a[i];
int tr = 0;
for(int j=i;j>=0;j--){
tr+=mapa[a[j]];
//cerr<<tr<<" ";
int zbir = tr-(maks-a[j]);
if(zbir==10) cerr<<i<<" "<<j<<" "<<tr<<endl;
o = max(o, zbir);
}
}
cout<<o<<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... |