Submission #859688

# Submission time Handle Problem Language Result Execution time Memory
859688 2023-10-10T13:30:08 Z Alfraganus Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
8 / 100
3000 ms 39248 KB
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define ll long long
#define all(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0), cin.tie(0);
#define fs first
#define ss second

#define print(a)          \
    for (auto x : a)      \
        cout << x << ' '; \
    cout << endl;

#define printmp(a)   \
    for (auto x : a) \
        cout << x.fs << ' ' << x.ss << endl;

void solve()
{
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for(int i = 0; i < n; i ++)
        cin >> a[i];
    while(q --){
        int l, r, k;
        cin >> l >> r >> k;
        bool flag = 1;
        l --;
        r --;
        for(int i = l; i <= r; i ++){
            for(int j = i - 1; j >= l; j --){
                if(a[i] < a[j] and a[i] + a[j] > k){
                    flag = false;
                    break;
                }
            }
            if(!flag)
                break;
        }
        if(flag)
            cout << 1 << endl;
        else
            cout << 0 << endl;
    }
}

signed main()
{
    fastio
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        cout << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 472 KB Output is correct
8 Correct 14 ms 348 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 7 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 472 KB Output is correct
8 Correct 14 ms 348 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 7 ms 460 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 38 ms 580 KB Output is correct
13 Correct 28 ms 344 KB Output is correct
14 Correct 78 ms 604 KB Output is correct
15 Correct 20 ms 464 KB Output is correct
16 Execution timed out 3004 ms 344 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 383 ms 38180 KB Output is correct
2 Correct 364 ms 39248 KB Output is correct
3 Correct 405 ms 38996 KB Output is correct
4 Correct 364 ms 39084 KB Output is correct
5 Execution timed out 3038 ms 14168 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3039 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 472 KB Output is correct
8 Correct 14 ms 348 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 7 ms 460 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 38 ms 580 KB Output is correct
13 Correct 28 ms 344 KB Output is correct
14 Correct 78 ms 604 KB Output is correct
15 Correct 20 ms 464 KB Output is correct
16 Execution timed out 3004 ms 344 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 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 472 KB Output is correct
8 Correct 14 ms 348 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 7 ms 460 KB Output is correct
11 Correct 6 ms 348 KB Output is correct
12 Correct 38 ms 580 KB Output is correct
13 Correct 28 ms 344 KB Output is correct
14 Correct 78 ms 604 KB Output is correct
15 Correct 20 ms 464 KB Output is correct
16 Execution timed out 3004 ms 344 KB Time limit exceeded
17 Halted 0 ms 0 KB -