제출 #502896

#제출 시각아이디문제언어결과실행 시간메모리
502896DragonO_oHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
0 / 100
456 ms25704 KiB
#include <bits/stdc++.h> using namespace std; #define x first #define y second #define pb push_back #define all(a) a.begin(),a.end() #define int long long typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int>pi; typedef pair<ll,ll>pll; typedef vector<ll>vll; typedef vector<int>vi; typedef vector<bool>vb; typedef vector<vi>vvi; typedef vector<vll>vvll; typedef vector<pi>vpi; typedef vector<pll>vpll; const int N=1e6+99; int a[N],pref[N],ans[N]; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m; cin>>n>>m; for(int i=1;i<=n;++i){ cin>>a[i]; } for(int i=2;i<=n;++i){ pref[i]=pref[i-1]; if(a[i]<a[i-1]){ pref[i]++; } } for(int i=1;i<=m;++i){ int l,r,k; cin>>l>>r>>k; ans[i]=(pref[r]-pref[l-1]?0LL:1LL); } for(int i=1;i<=m;++i){ cout<<ans[i]<<"\n"; } }
#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...