답안 #595253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
595253 2022-07-13T13:30:36 Z zxcvbnm Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<pair<int, int>> a(n);
	for(auto& i : a) {
		cin >> i.first >> i.second;
	}

	sort(a.begin(), a.end());
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		ll curr = a[i].second;
		ans = max(ans, curr);
		for(int j = i-1; j >= 0; j--) {
			curr += a[j].second - (a[j+1].first - a[j].first);
			ans = max(ans, curr);
		}
	}
	
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -