Submission #979816

# Submission time Handle Problem Language Result Execution time Memory
979816 2024-05-11T12:11:21 Z asdasdqwer Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
8 / 100
3000 ms 8544 KB
#include <bits/stdc++.h>
using namespace std;

signed main() {
    int n,m;cin>>n>>m;
    vector<int> a(n);
    for (auto &x:a)cin>>x;

    for (int i=0;i<m;i++) {
        vector<int> tmp;
        int l, r,k;cin>>l>>r>>k;l--;r--;
        for (int j=l;j<=r;j++) {
            tmp.push_back(a[j]);
        }

        for (int j=0;j<(int)tmp.size();j++) {
            for (int o=1;o<(int)tmp.size();o++) {
                if (tmp[o-1] > tmp[o] && abs(tmp[o] + tmp[o-1]) <= k) {
                    swap(tmp[o-1], tmp[o]);
                }
            }
        }

        vector<int> tmp2 = tmp;
        sort(tmp.begin(), tmp.end());
        bool pos = true;
        for (int j=0;j<(int)tmp.size();j++) {
            if (tmp[j] != tmp2[j]) {
                pos = false;
                break;
            }
        }

        cout<<pos<<"\n";
    }    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 42 ms 452 KB Output is correct
7 Correct 39 ms 348 KB Output is correct
8 Correct 57 ms 444 KB Output is correct
9 Correct 19 ms 476 KB Output is correct
10 Correct 67 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 42 ms 452 KB Output is correct
7 Correct 39 ms 348 KB Output is correct
8 Correct 57 ms 444 KB Output is correct
9 Correct 19 ms 476 KB Output is correct
10 Correct 67 ms 468 KB Output is correct
11 Correct 1845 ms 540 KB Output is correct
12 Execution timed out 3083 ms 608 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3059 ms 8544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3071 ms 1104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 42 ms 452 KB Output is correct
7 Correct 39 ms 348 KB Output is correct
8 Correct 57 ms 444 KB Output is correct
9 Correct 19 ms 476 KB Output is correct
10 Correct 67 ms 468 KB Output is correct
11 Correct 1845 ms 540 KB Output is correct
12 Execution timed out 3083 ms 608 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 42 ms 452 KB Output is correct
7 Correct 39 ms 348 KB Output is correct
8 Correct 57 ms 444 KB Output is correct
9 Correct 19 ms 476 KB Output is correct
10 Correct 67 ms 468 KB Output is correct
11 Correct 1845 ms 540 KB Output is correct
12 Execution timed out 3083 ms 608 KB Time limit exceeded
13 Halted 0 ms 0 KB -