# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
135336 | Just_Solve_The_Problem | Bulldozer (JOI17_bulldozer) | C++11 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = (int)2e3 + 7;
int a[N];
int x[N], y[N], w[N], pos[N];
int n;
ll pref[N];
main() {
scanf("%d", &n);
iota(pos, pos + n, 0);
for (int i = 0; i < n; i++) {
scanf("%d %d %d", &x[i], &y[i], &w[i]);
}
sort(pos, pos + n, [&](const int &A, const int &B){
return x[A] < x[B];
});
ll mn = 0, ans = 0;
for (int i = 0; i < n; i++) {
if (i) pref[i] = pref[i - 1];
pref[i] += w[pos[i]];
ans = max((pref[i] - mn), ans);
mn = min(mn, pref[i]);
}
cout << 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |