Submission #497474

# Submission time Handle Problem Language Result Execution time Memory
497474 2021-12-23T06:35:05 Z Nalrimet Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
545 ms 6148 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")
      |
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 434 ms 6148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 545 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -