제출 #343332

#제출 시각아이디문제언어결과실행 시간메모리
343332jenkinsserHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3072 ms8300 KiB
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define st first #define nd second #define pii pair<int,int> #define N 1000005 #define INF 1e9+5 #define sp " " #define endl "\n" #define fastio() ios_base::sync_with_stdio(0);cin.tie(0); #define all(x) (x).begin(),(x).end() #define ll long long using namespace std; int n,m,l,r,k; int main(){ cin >> n >> m; vector<int> w(n); vector<int> s(n); for(int i=0;i<n;i++){ cin >> w[i]; } for(int i=0;i<m;i++){ cin >> l >> r >> k; int mx=0; for(int j=l;j<=l;j++){ s[j]=w[j]; } for(int j=l;j<=r;j++){ int h=j; while(h>=l&&s[h]<s[h-1]){ swap(s[h],s[h-1]); mx=max(mx,s[h-1]+s[h]); h--; } } if(mx<=k) cout << 1 << endl; else cout << 0 << endl; } }
#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...