제출 #595485

#제출 시각아이디문제언어결과실행 시간메모리
595485BelphegorArt Exhibition (JOI18_art)C++14
50 / 100
19 ms912 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pi; pi A[5005]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; for(int i=1; i<=n; i++) cin>>A[i].first>>A[i].second; sort(A+1,A+n+1); for(int i=2; i<=n; i++) A[i].second+=A[i-1].second; ll ans = 0; for(int i=1; i<=n; i++){ for(int j=i; j<=n; j++){ ll s = A[j].second - A[i-1].second; s-=A[j].first-A[i].first; ans = max(ans,s); } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...