답안 #883325

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

using namespace std;

int main() {
    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++){
        int l,r,ki;
        cin >> l >> r >> ki;
        vector<int> vec(books.begin()+l-1, books.begin()+r);
        bool broken = false;
        for (int k = 0;k < vec.size()-1;k++){
            if (vec[k] > vec[k+1]){
                if (vec[k]+vec[k+1] <= ki){
                    swap(vec[k], vec[k+1]);
                }else{
                    broken = true;
                    break;
                }
            }
            if (is_sorted(vec.begin(), vec.end())){
                break;
            }
        }
        if (broken){
            cout << 0 << "\n";
        }else{
            cout << 1 << "\n";
        }
    }
    return 0;
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:18:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int k = 0;k < vec.size()-1;k++){
      |                        ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 436 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 8 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 436 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 8 ms 504 KB Output is correct
11 Correct 7 ms 604 KB Output is correct
12 Correct 7 ms 604 KB Output is correct
13 Correct 11 ms 788 KB Output is correct
14 Correct 13 ms 860 KB Output is correct
15 Correct 12 ms 856 KB Output is correct
16 Execution timed out 3032 ms 848 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3093 ms 72760 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1728 ms 8580 KB Output is correct
2 Execution timed out 3034 ms 8072 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 436 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 8 ms 504 KB Output is correct
11 Correct 7 ms 604 KB Output is correct
12 Correct 7 ms 604 KB Output is correct
13 Correct 11 ms 788 KB Output is correct
14 Correct 13 ms 860 KB Output is correct
15 Correct 12 ms 856 KB Output is correct
16 Execution timed out 3032 ms 848 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 436 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 6 ms 348 KB Output is correct
10 Correct 8 ms 504 KB Output is correct
11 Correct 7 ms 604 KB Output is correct
12 Correct 7 ms 604 KB Output is correct
13 Correct 11 ms 788 KB Output is correct
14 Correct 13 ms 860 KB Output is correct
15 Correct 12 ms 856 KB Output is correct
16 Execution timed out 3032 ms 848 KB Time limit exceeded
17 Halted 0 ms 0 KB -