| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 837611 | Koyote | Art Exhibition (JOI18_art) | C++11 | 147 ms | 24712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 5e5 + 2;
int n;
pair<ll, int> arr[maxN];
ll pfx[maxN], pre_min = numeric_limits<ll>::max(), ans;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
for (int i = 0; i < n; i++)
cin >> arr[i].first >> arr[i].second;
sort(arr, arr + n);
for (int i = 0; i < n; i++) {
pfx[i + 1] = pfx[i] + arr[i].second;
pre_min = min(pre_min, pfx[i] - arr[i].first);
ans = max(ans, pfx[i + 1] - arr[i].first - pre_min);
}
cout << ans << '\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... | ||||
