# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
163425 | iefnah06 | Art Exhibition (JOI18_art) | C++11 | 338 ms | 20984 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 4e18;
const int MAXN = 6e5;
int N;
pair<ll, int> A[MAXN];
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%lld %d", &A[i].first, &A[i].second);
}
sort(A, A + N);
ll ma = -INF;
ll ans = -INF;
ll pref = 0;
for (int i = 0; i < N; i++) {
ma = max(ma, A[i].first - pref);
pref += A[i].second;
ans = max(ans, pref - A[i].first + ma);
}
printf("%lld\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |