| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1369395 | norrawichzzz | Art Exhibition (JOI18_art) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
const long long INF =1e18;
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin>> n;
vector<pair<long long,int>> a;
for (int i=0; i<n; i++) {
long long A, B;
cin>> A>> B;
a.push_back({A, B});
}
sort(a.begin(), a.end());
vector<long long> p(n+1, 0);
for (int i=n-1; i>=0; i--) p[i] = p[i+1]+a[i].second;
long long mx = 0, ans=-INF;
for (int i=0; i<n; i++) {
ans = max(ans, -a[i].first + mx - p[i+1]);
mx = max(mx, a[i].first+p[i]);
}
cout<< ans;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
