Submission #959836

# Submission time Handle Problem Language Result Execution time Memory
959836 2024-04-09T07:41:42 Z ezzzay Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
0 / 100
3000 ms 8476 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
vector<bool>ans;
int arr[N];
int st[4*N];
void build(int node, int L, int R){
	if(L==R){
		st[node]=arr[L];
		return;
	}
	int mid=(L+R)/2;
	build(node*2,L,mid);
	build(node*2+1,mid+1,R);
	st[node]=max(st[node*2+1],st[node*2]);
}
int find(int node, int L, int R, int l, int r){
	if(l<=L and R<=r)return st[node];
	if(l>R or r<L)return -1e9;
	int mid=(L+R)/2;
	return max(find(node*2,L,mid,l,r),find(node*2+1,mid+1,R,l,r));
}
signed main(){
	int n,q;
	cin>>n>>q;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	build(1,1,n);
	while(q--){
		int l,r,k;
		cin>>l>>r>>k;
		bool u=1;
		for(int i=l+1;i<=r;i++){
			int x=find(1,1,n,l,i-1);
			if(x< arr[i])continue;
			if(x+arr[i]>k)u=0;
		}
		ans.pb(u);
	}
	for(auto a:ans)cout<<a<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2516 KB Output is correct
7 Correct 13 ms 2396 KB Output is correct
8 Correct 16 ms 2396 KB Output is correct
9 Correct 7 ms 2396 KB Output is correct
10 Incorrect 15 ms 2396 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2516 KB Output is correct
7 Correct 13 ms 2396 KB Output is correct
8 Correct 16 ms 2396 KB Output is correct
9 Correct 7 ms 2396 KB Output is correct
10 Incorrect 15 ms 2396 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 88 ms 8476 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3034 ms 5008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2516 KB Output is correct
7 Correct 13 ms 2396 KB Output is correct
8 Correct 16 ms 2396 KB Output is correct
9 Correct 7 ms 2396 KB Output is correct
10 Incorrect 15 ms 2396 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 4 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2516 KB Output is correct
7 Correct 13 ms 2396 KB Output is correct
8 Correct 16 ms 2396 KB Output is correct
9 Correct 7 ms 2396 KB Output is correct
10 Incorrect 15 ms 2396 KB Output isn't correct
11 Halted 0 ms 0 KB -