| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 966860 | vjudge1 | Art Exhibition (JOI18_art) | C++11 | 1 ms | 2392 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define fi first
#define se second
ll N;
pll arr[500100];
ll psum[500100];
ll ans, maks;
int main()
{
cin >> N;
for(int i=1; i<=N; i++) {
cin >> arr[i].fi >> arr[i].se;
}
sort(arr+1, arr+N+1);
for(int i=1; i<=N; i++) {
psum[i] = psum[i-1] + arr[i].se;
}
for(int i=N; i>=1; i--) {
maks = max(maks, psum[i]-arr[i].fi);
ans = max(ans, maks + arr[i].fi-psum[i-1]);
}
cout << ans << endl;
}| # | 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... | ||||
