답안 #471629

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
471629 2021-09-10T04:43:25 Z dqk Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 472 KB
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, m;
    std::cin >> n >> m;
    std::vector<i64> a(n + 1, 0);
    for (int i = 1; i <= n; ++i) {
        std::cin >> a[i];
    }
    std::vector<bool> ok(n + 1, true);
    ok[0] = false;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (a[i] - a[i - 1] > m) {
            ans++;
            if (!ok[i - 1]) {
                a[i] = a[i - 1] + m;
                ok[i] = false;
            }
        }
    }
    for (int i = 1; i <= n; ++i) {
        assert(a[i] - a[i - 1] <= m);
    }
    std::cout << ans << "\n";
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Runtime error 1 ms 472 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Runtime error 1 ms 472 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Runtime error 1 ms 472 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Runtime error 1 ms 472 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -