답안 #497471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
497471 2021-12-23T06:33:22 Z Nalrimet Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
8 / 100
3000 ms 13596 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];

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;
        for(int i = l; i < r; i++){
            for(int j = i + 1; j <= r; j++){
                if(a[i] > a[j]){
                    if(a[i] + a[j] > k){
                        ok = 0;
                        break;
                    }
                }
            }
            if(!ok) break;
        }
        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 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 23 ms 304 KB Output is correct
9 Correct 12 ms 204 KB Output is correct
10 Correct 10 ms 324 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 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 23 ms 304 KB Output is correct
9 Correct 12 ms 204 KB Output is correct
10 Correct 10 ms 324 KB Output is correct
11 Correct 16 ms 328 KB Output is correct
12 Correct 122 ms 332 KB Output is correct
13 Correct 91 ms 344 KB Output is correct
14 Correct 208 ms 332 KB Output is correct
15 Correct 116 ms 332 KB Output is correct
16 Execution timed out 3071 ms 332 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 463 ms 6180 KB Output is correct
2 Correct 525 ms 13360 KB Output is correct
3 Correct 495 ms 13412 KB Output is correct
4 Correct 499 ms 13596 KB Output is correct
5 Execution timed out 3026 ms 9160 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3087 ms 716 KB Time limit exceeded
2 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 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 23 ms 304 KB Output is correct
9 Correct 12 ms 204 KB Output is correct
10 Correct 10 ms 324 KB Output is correct
11 Correct 16 ms 328 KB Output is correct
12 Correct 122 ms 332 KB Output is correct
13 Correct 91 ms 344 KB Output is correct
14 Correct 208 ms 332 KB Output is correct
15 Correct 116 ms 332 KB Output is correct
16 Execution timed out 3071 ms 332 KB Time limit exceeded
17 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 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 23 ms 304 KB Output is correct
9 Correct 12 ms 204 KB Output is correct
10 Correct 10 ms 324 KB Output is correct
11 Correct 16 ms 328 KB Output is correct
12 Correct 122 ms 332 KB Output is correct
13 Correct 91 ms 344 KB Output is correct
14 Correct 208 ms 332 KB Output is correct
15 Correct 116 ms 332 KB Output is correct
16 Execution timed out 3071 ms 332 KB Time limit exceeded
17 Halted 0 ms 0 KB -