Submission #226034

# Submission time Handle Problem Language Result Execution time Memory
226034 2020-04-22T11:10:03 Z Dilshod_Imomov Art Exhibition (JOI18_art) C++17
0 / 100
5 ms 384 KB
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
# define int long long
  
using namespace std;
  
const int N = 1e5 + 7;
const int mod = 1e9 + 7;

int32_t main() {
	speed;
	int n;
	cin >> n;

	vector < pair < int, int > > vc(n);

	for ( int i = 0; i < n; i++ ) {
		cin >> vc[i].first >> vc[i].second;
	}
	sort( vc.begin(), vc.end() );
	int ans = 0;

	for ( int i = 0; i < n; i++ ) {
		int mn = 1e9, mx = 0, sum = 0;
		for ( int j = i; j < n; j++ ) {
			mn = min( mn, vc[j].first );
			mx = max( mx, vc[j].first );
			sum += vc[j].second;
			ans = max( ans, sum - (mx - mn) );
		}
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -