Submission #959895

# Submission time Handle Problem Language Result Execution time Memory
959895 2024-04-09T09:41:51 Z ezzzay Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 9380 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 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2396 KB Output is correct
7 Correct 10 ms 2512 KB Output is correct
8 Correct 17 ms 2396 KB Output is correct
9 Correct 7 ms 2392 KB Output is correct
10 Correct 15 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2396 KB Output is correct
7 Correct 10 ms 2512 KB Output is correct
8 Correct 17 ms 2396 KB Output is correct
9 Correct 7 ms 2392 KB Output is correct
10 Correct 15 ms 2396 KB Output is correct
11 Correct 178 ms 2392 KB Output is correct
12 Correct 585 ms 2692 KB Output is correct
13 Correct 685 ms 2900 KB Output is correct
14 Correct 1121 ms 2744 KB Output is correct
15 Correct 1147 ms 2744 KB Output is correct
16 Correct 1906 ms 2696 KB Output is correct
17 Correct 1196 ms 2640 KB Output is correct
18 Correct 1761 ms 2896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 86 ms 7248 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3031 ms 4696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2396 KB Output is correct
7 Correct 10 ms 2512 KB Output is correct
8 Correct 17 ms 2396 KB Output is correct
9 Correct 7 ms 2392 KB Output is correct
10 Correct 15 ms 2396 KB Output is correct
11 Correct 178 ms 2392 KB Output is correct
12 Correct 585 ms 2692 KB Output is correct
13 Correct 685 ms 2900 KB Output is correct
14 Correct 1121 ms 2744 KB Output is correct
15 Correct 1147 ms 2744 KB Output is correct
16 Correct 1906 ms 2696 KB Output is correct
17 Correct 1196 ms 2640 KB Output is correct
18 Correct 1761 ms 2896 KB Output is correct
19 Execution timed out 3075 ms 9380 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 3 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 11 ms 2396 KB Output is correct
7 Correct 10 ms 2512 KB Output is correct
8 Correct 17 ms 2396 KB Output is correct
9 Correct 7 ms 2392 KB Output is correct
10 Correct 15 ms 2396 KB Output is correct
11 Correct 178 ms 2392 KB Output is correct
12 Correct 585 ms 2692 KB Output is correct
13 Correct 685 ms 2900 KB Output is correct
14 Correct 1121 ms 2744 KB Output is correct
15 Correct 1147 ms 2744 KB Output is correct
16 Correct 1906 ms 2696 KB Output is correct
17 Correct 1196 ms 2640 KB Output is correct
18 Correct 1761 ms 2896 KB Output is correct
19 Runtime error 86 ms 7248 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -