| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 202339 | someone_aa | Art Exhibition (JOI18_art) | C++17 | 842 ms | 21864 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 500100;
vector<pair<ll,ll> > v;
ll pref[maxn], n;
int main() {
cin>>n;
ll a, b;
for(int i=1;i<=n;i++) {
cin>>a>>b;
v.pb({a, b});
} sort(v.begin(), v.end());
ll result = 0LL;
ll maxv = 0LL;
for(int i=1;i<=n;i++) {
maxv = max(maxv, v[i-1].first - pref[i-1]);
pref[i] = pref[i-1] + v[i-1].second;
result = max(result, pref[i] - v[i-1].first + maxv);
}
cout<<result<<"\n";
}| # | 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... | ||||
