제출 #492862

#제출 시각아이디문제언어결과실행 시간메모리
492862watoKEArt Exhibition (JOI18_art)C++17
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> #define ll int #define pb push_back using namespace std; int n,m,a,b,c,cnt,g,f,d,e,cvp,k; pair<ll,ll> dizi[100005]; int fark[100005]; string s; int main() { cin>>n; for (int i=0;i<n;i++) cin>>dizi[i].first>>dizi[i].second; sort(dizi,dizi+n); ll toplam=dizi[n-1].second; ll kntrl=dizi[n-1].first; ll cvp=toplam; for (int i=n-2;i>=0;i--) { toplam+=dizi[i].second-(kntrl-dizi[i].first); toplam=max(toplam,dizi[i].second); kntrl=dizi[i].first; cvp=max(cvp,toplam); } cout<<cvp; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...