제출 #1172984

#제출 시각아이디문제언어결과실행 시간메모리
1172984ibrahim001Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
13 / 100
1106 ms33752 KiB
#include "bits/stdc++.h"
#include <chrono>
#include <thread>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define intt long long
#define int intt
#define pb push_back
#define endl '\n'
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<intt,intt>
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) x.begin(), x.end()
using namespace std;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int sz = 2e6+5;
const int sz1 = 2005;
const int mod = 998244353;
const int inf = 2e9+7;
const intt infl = 1e18;
const ld eps = 1e-9;
int a[sz], w[sz];
intt i,j;
void solve(){
    int n, m;
    cin >> n >> m;
    for ( i = 1; i <= n; i++ ){
        cin >> w[i];
    }
    set<int>s;
    for ( i = 2; i <= n; i++ ){
        if ( w[i-1] > w[i] ){
            s.insert(i-1);
        }
    }
    s.insert(n);
    while (m--){
        int l, r, k;
        cin >> l >> r >> k;
        cout << (s.lower_bound(l) == s.lower_bound(r)) << endl;
    }
}
signed main(){
    fastio;
    int t = 1;
    // cin >> t;
    for ( int cs = 1; cs <= t; cs++ ) {
        // cout << "Case " << cs << ": ";
        solve();
    }
    // while ( cin >> n and n ){
    //     cin >> m;
    //     solve();
    // }
}
// 4 15 8 23 42 16
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...