제출 #392790

#제출 시각아이디문제언어결과실행 시간메모리
392790wildturtleArt Exhibition (JOI18_art)C++14
100 / 100
591 ms17888 KiB
#include<bits/stdc++.h> #define ll long long #define f first #define sc second using namespace std; ll a,b,c,d,i,e,f,g,n,m,k,l,maxx,maxx1; pair <ll,ll> A[500005]; int main() { cin>>n; for(ll i=1;i<=n;i++) { cin>>A[i].f>>A[i].sc; } sort(A+1,A+1+n); for(ll i=1;i<=n;i++) { a+=A[i].sc; maxx1=max(maxx1,-(a-A[i].sc)+A[i].f); maxx=max(maxx,a-A[i].f+maxx1); //cout<<a<<" "<<maxx1<<" "<<maxx<<endl; } cout<<maxx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...