| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1307997 | dimitris71 | Art Exhibition (JOI18_art) | C++20 | 0 ms | 332 KiB |
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
vector < pair < long long, long long > > X;
int main() {
int N; long long res = 0, best = -1e18, sum = 0;
scanf("%d", &N);
for (int i=0; i<N; i++) {
long long a, b;
scanf("%lld%lld", &a, &b);
X.push_back(make_pair(a, b));
}
sort(X.begin(), X.end());
for (int i=0; i<N; i++) {
best = min(best, sum - X[i].first);
sum += X[i].second;
res = max(res, sum - X[i].first - best);
}
printf("%lld\n", res);
}
컴파일 시 표준 에러 (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... | ||||
