답안 #883291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
883291 2023-12-05T04:56:43 Z AI_2512 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 94052 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long n, m;
    cin >> n >> m;

    vector<int> books(n);
    vector<vector<int>> days(m, vector<int>(3));

    for (int i = 0; i < n; i++) {
        cin >> books[i];
    }

    for (int i = 0; i < m; i++) {
        cin >> days[i][0] >> days[i][1] >> days[i][2];


        bool broken = false;

        for (int k = days[i][0] - 1; k < days[i][1] - 1; k++) {
            if (books[k] > books[k + 1]) {
                if (books[k] + books[k + 1] <= days[i][2]) {
                    swap(books[k], books[k + 1]);
                } else {
                    broken = true;
                    break;
                }
            }
        }

        if (broken) {
            cout << 0 << "\n";
        } else {
            cout << 1 << "\n";
        }
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 387 ms 81552 KB Output is correct
2 Correct 397 ms 93948 KB Output is correct
3 Correct 400 ms 93840 KB Output is correct
4 Correct 384 ms 94052 KB Output is correct
5 Execution timed out 3049 ms 69408 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1764 ms 7980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -