# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
310664 | LucaDantas | Art Exhibition (JOI18_art) | C++17 | 286 ms | 21112 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;
#define ff first
#define ss second
#define rall(a) (a).rbegin(), (a).rend()
int main() {
int n; scanf("%d", &n);
vector<pii> a(n);
for(auto& it : a)
scanf("%lld %lld", &it.ff, &it.ss);
sort(rall(a));
// Os caras com maior peso vem na frente
ll maior = -0x3f3f3f3f3f3f3f3f, ans = -0x3f3f3f3f3f3f3f3f;
for(int i = 0; i < n; i++) {
maior = max(maior + a[i].ss, a[i].ss - a[i].ff);
ans = max(ans, maior + a[i].ff);
}
printf("%lld\n", ans);
}
컴파일 시 표준 에러 (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... |