답안 #497475

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
497475 2021-12-23T06:35:55 Z Nalrimet Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 8284 KB
#include <bits/stdc++.h>

#pragma GCC optimization("g", on)
#pragma GCC optimize ("inline")
#pragma GCC optimization("03")
#pragma GCC optimization("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")

#define ll long long
#define pb push_back
#define F first
#define S second

using namespace std;

const int N = 1e6 + 5;
const int inf = 1e9 + 7;

int n, m, l, r, k, a[N], mx;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	cin >> n >> m;

    for(int i = 1; i <= n; ++i){
        cin >> a[i];
    }

    while(m--){
        cin >> l >> r >> k;
        bool ok = 1;
        mx = 0;
        for(int i = l; i <= r; i++){
            if(mx > a[i]){
                if(a[i] + mx > k){
                    ok = 0;
                    break;
                }
            }
            mx = max(mx, a[i]);
        }
        cout << ok << '\n';
	}

	return 0;
}

Compilation message

sortbooks.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization("g", on)
      | 
sortbooks.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    5 | #pragma GCC optimization("03")
      | 
sortbooks.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    6 | #pragma GCC optimization("unroll-loops")
      | 
sortbooks.cpp:7: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    7 | #pragma comment(linker, "/stack:200000000")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 12 ms 344 KB Output is correct
17 Correct 11 ms 332 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 427 ms 6212 KB Output is correct
2 Correct 492 ms 6232 KB Output is correct
3 Correct 426 ms 6104 KB Output is correct
4 Correct 490 ms 6164 KB Output is correct
5 Execution timed out 3062 ms 4348 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 376 ms 884 KB Output is correct
2 Correct 1332 ms 2756 KB Output is correct
3 Execution timed out 3037 ms 2420 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 12 ms 344 KB Output is correct
17 Correct 11 ms 332 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
19 Correct 1457 ms 1460 KB Output is correct
20 Correct 1468 ms 8284 KB Output is correct
21 Execution timed out 3078 ms 6116 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 12 ms 344 KB Output is correct
17 Correct 11 ms 332 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
19 Correct 427 ms 6212 KB Output is correct
20 Correct 492 ms 6232 KB Output is correct
21 Correct 426 ms 6104 KB Output is correct
22 Correct 490 ms 6164 KB Output is correct
23 Execution timed out 3062 ms 4348 KB Time limit exceeded