# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
730951 | sleepntsheep | Art Exhibition (JOI18_art) | C++17 | 382 ms | 44324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
using ll = long long;
ll n, z = 0;
scanf("%lld", &n);
vector<pair<ll, ll>> v(n+1);
for (auto it = v.begin() + 1; it != v.end(); it++) scanf("%lld%lld", &it->first, &it->second);
sort(v.begin(), v.end());
set<ll> heap;
for (int i = 1; i <= n; i++)
{
v[i].second += v[i-1].second;
z = max(z, v[i].second - v[i-1].second);
if (heap.size())
z = max(z, v[i].second - v[i].first + *heap.rbegin());
heap.insert(v[i].first - v[i-1].second);
heap.insert(v[i+1].first - v[i].second);
}
printf("%lld", z);
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... |