# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
984710 | vjudge2 | Fish 3 (JOI24_fish3) | C++17 | 123 ms | 17324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, k, q;
cin >> n >> k;
vector<int> c(n+1), ac(n+1, 0), a(n+1, 0), b(n+1, 0), aff(n+1, 0);
for (int i = 1; i <= n; i++) {
cin >> c[i];
ac[i] = c[i];
}
int prv = n;
for (int i = n - 1; i >= 1; i--) {
if (ac[i] > ac[i + 1]) {
int diff = ac[i] - ac[i + 1];
diff = (diff + k - 1) / k;
a[i] += diff;
ac[i] -= diff * k;
} else {
int t = 0;
for (int j = i + 1; j <= prv; j++) t++, aff[j] = t;
prv = i;
}
}
int t = 0;
for (int j = 1; j <= prv; j++) t++, aff[j] = t;
for (int i = 1; i <= n; i++) a[i] += a[i - 1];
# | 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... |