Submission #883292

# Submission time Handle Problem Language Result Execution time Memory
883292 2023-12-05T04:58:44 Z AI_2512 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 67112 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++){
        cin >>days[i][0] >> days[i][1] >> days[i][2];
        vector<int> vec(books.begin()+days[i][0]-1, books.begin()+days[i][1]);
        bool broken = false;
        for (int k = 0;k < vec.size()-1;k++){
            if (vec[k] > vec[k+1]){
                if (vec[k]+vec[k+1] <= days[i][2]){
                    int t = vec[k];
                    vec[k] = vec[k+1];
                    vec[k+1] = t;
                }else{
                    broken = true;
                    break;
                }
            }
        }
        if (broken){
            cout << 0 << "\n";
        }else{
            cout << 1 << "\n";
        }
    }
    return 0;
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for (int k = 0;k < vec.size()-1;k++){
      |                        ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 7 ms 604 KB Output is correct
12 Correct 8 ms 604 KB Output is correct
13 Correct 9 ms 604 KB Output is correct
14 Correct 15 ms 780 KB Output is correct
15 Correct 13 ms 604 KB Output is correct
16 Correct 23 ms 780 KB Output is correct
17 Correct 25 ms 1116 KB Output is correct
18 Correct 23 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 67112 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1585 ms 7060 KB Output is correct
2 Execution timed out 3036 ms 8244 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 7 ms 604 KB Output is correct
12 Correct 8 ms 604 KB Output is correct
13 Correct 9 ms 604 KB Output is correct
14 Correct 15 ms 780 KB Output is correct
15 Correct 13 ms 604 KB Output is correct
16 Correct 23 ms 780 KB Output is correct
17 Correct 25 ms 1116 KB Output is correct
18 Correct 23 ms 860 KB Output is correct
19 Execution timed out 3033 ms 17756 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 7 ms 604 KB Output is correct
12 Correct 8 ms 604 KB Output is correct
13 Correct 9 ms 604 KB Output is correct
14 Correct 15 ms 780 KB Output is correct
15 Correct 13 ms 604 KB Output is correct
16 Correct 23 ms 780 KB Output is correct
17 Correct 25 ms 1116 KB Output is correct
18 Correct 23 ms 860 KB Output is correct
19 Execution timed out 3048 ms 67112 KB Time limit exceeded
20 Halted 0 ms 0 KB -