| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1367196 | edo | Art Exhibition (JOI18_art) | C++20 | 98 ms | 8260 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<pair<ll, ll>> v(n);
for(int i = 0; i < n; ++i) {
ll a, b;
cin >> a >> b;
v[i] = {a, b};
}
ranges::sort(v);
ll ans = -(1ll << 60), best = ans, pref = 0;
for(auto [x, y] : v) {
ans = max(ans, y);
ans = max(ans, pref + y - x + best);
best = max(best, x - pref);
pref += y;
}
cout << ans << "\n";
return 0;
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
