제출 #312905

#제출 시각아이디문제언어결과실행 시간메모리
312905noob_c0deArt Exhibition (JOI18_art)C++17
50 / 100
1089 ms13944 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ar array #define db double const int mxn=5e5+3; int n; ar<int,2> a[mxn]; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; for (int i=1;i<=n;i++) cin>>a[i][0]>>a[i][1]; sort(a+1,a+n+1); int ans=0; // n^2 for (int i=1;i<=n;i++) { int sum=0; for (int j=i;j<=n;j++) { sum+=a[j][1]; ans=max(ans,sum-(a[j][0]-a[i][0])); } } cout<<ans; 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...