이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
pair<long long, long long> arr[n];
for(int i=0; i<n; i++){
cin>>arr[i].first>>arr[i].second;
}
sort(arr, arr+n);
long long ans = 0;
for(int l=0; l<n; l++){
for(int r=l; r<n; r++){
long long sum = 0;
for(int i=l; i<=r; i++){
sum += arr[i].second;
}
ans = max(ans, sum-(arr[r].first-arr[l].first));
}
}
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |