Submission #1357017

#TimeUsernameProblemLanguageResultExecution timeMemory
1357017veyis_116Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
int main(){
      ios::sync_with_stdio(0);
      cin.tie(0);
      cout.tie(0);
      ll t; cin>>t;
      while(t--){
        ll n; cin>>n;
        ll a[n+1]; for(ll i=1;i<=n;i++) cin>>a[i];
        ll pre[n+1]; pre[0]=0;
        for(ll i=1;i<=n;i++){
            if(a[i]>a[i+1]) pre[i]=pre[i-1]-1;
            else pre[i]=pre[i-1];
        } 
        while(m--){
            ll l,r,v; cin>>l>>r;
            if(pre[r-1]-pre[l-1]<0) cout<<1<<endl;
            else cout<<0<<endl;
        }
        
      }
}

Compilation message (stderr)

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:18:15: error: 'm' was not declared in this scope
   18 |         while(m--){
      |               ^