답안 #859727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859727 2023-10-10T14:41:25 Z Alfraganus Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 22980 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--;
        int mx = 0;
        for (int i = l; i <= r; i++)
        {
            if(mx > a[i] and mx + a[i] > k){
                flag = 0;
                break;
            }
            mx = max(mx, a[i]);
        }
        if (flag)
            cout << 1 << endl;
        else
            cout << 0 << endl;
    }
}

signed main()
{
    fastio int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        cout << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 472 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 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 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 472 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 11 ms 584 KB Output is correct
17 Correct 11 ms 464 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 338 ms 22412 KB Output is correct
2 Correct 353 ms 22788 KB Output is correct
3 Correct 352 ms 22980 KB Output is correct
4 Correct 331 ms 22776 KB Output is correct
5 Execution timed out 3026 ms 9620 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 504 ms 3152 KB Output is correct
2 Correct 1631 ms 2980 KB Output is correct
3 Execution timed out 3028 ms 2868 KB Time limit exceeded
4 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 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 472 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 11 ms 584 KB Output is correct
17 Correct 11 ms 464 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
19 Correct 1943 ms 8116 KB Output is correct
20 Correct 1927 ms 8352 KB Output is correct
21 Execution timed out 3034 ms 6468 KB Time limit exceeded
22 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 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 472 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 11 ms 584 KB Output is correct
17 Correct 11 ms 464 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
19 Correct 338 ms 22412 KB Output is correct
20 Correct 353 ms 22788 KB Output is correct
21 Correct 352 ms 22980 KB Output is correct
22 Correct 331 ms 22776 KB Output is correct
23 Execution timed out 3026 ms 9620 KB Time limit exceeded
24 Halted 0 ms 0 KB -