# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
344543 | bachaquer | 금 캐기 (IZhO14_divide) | C++14 | 0 ms | 364 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll n, x, g, d;
struct lol {
ll x;
ll g;
ll d;
};
int main() {
freopen("divide.in", "r", stdin);
freopen("divide.out", "w", stdout);
cin >> n;
vector<lol> v;
for (int i = 0; i < n; i++) {
cin >> x >> g >> d;
v.pb({x, g, d});
}
ll mx = -1;
for (int i = 0; i < n; i++) {
vector<lol> khm;
khm = v;
ll sum = 0;
for (int j = i; j < n; j++) {
sum += khm[j].g;
if (khm[j + 1].d + khm[j].d < (khm[j + 1].x - khm[j].x)) break;
else {
ll rozn = (khm[j + 1].x - khm[j].x);
khm[j].d -= rozn;
if (khm[j].d < 0) {
khm[j + 1].d += khm[j].d;
khm[j].d = 0;
}
}
}
mx = max(mx, sum);
}
cout << mx;
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... |