Submission #927832

# Submission time Handle Problem Language Result Execution time Memory
927832 2024-02-15T11:29:33 Z takeonicky Art Exhibition (JOI18_art) C++14
0 / 100
0 ms 600 KB
#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+1; 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
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -