# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
913866 |
2024-01-20T11:18:43 Z |
LM1 |
Art Exhibition (JOI18_art) |
C++14 |
|
1 ms |
348 KB |
#include<bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
int n,pr[(int)5e5+5],ans=0,mn;
vector<pair<int,int>>v;
int main(){
cin>>n;
v.resize(n+1);
for(int i=1;i<=n;i++){
// int size,value;cin>>size>>value;
// v.push_back({value,size});
cin>>v[i].ff>>v[i].ss;
}
sort(v.begin()+1,v.end());
for(int i=1;i<=n;i++){
pr[i]=pr[i-1]+v[i].ss;
}mn=-v[1].ff;
for(int r=1;r<=n;r++){
ans=max(ans,pr[r]-v[r].ff-mn);
mn=min(mn,pr[r]-v[r+1].ff);
}
cout<<ans;
}
//pr[r]-pr[l-1]-(f
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |