Submission #1071276

# Submission time Handle Problem Language Result Execution time Memory
1071276 2024-08-23T06:30:24 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 4324 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int a[n];
	for(int i=1 ;i<=n ;i++){
		cin>>a[i];
	}
	while(m--){
		int l,r,k; 
		cin>>l>>r>>k;
		int mx=0,id=0;
		for(int i=l ;i<=r ;i++){
			if (mx<a[i]){
				mx=a[i];
				id=i;
			}
		}
		int qwesdasdfkbnfkndb=0;	
		for(int i=id+1 ; i<=r; i++){
			if (mx+a[i]>k){
				qwesdasdfkbnfkndb=1;
				cout<<"0\n";
				i=r+1;
			}
			//cout<<k<<" "<<mx<<" "<<a[i]<<" "<<qwesdasdfkbnfkndb<<" "<<i<<"\n";
		}
		//cout<<mx<<" ";
		if (qwesdasdfkbnfkndb==0){
			cout<<"1\n";
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 416 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 416 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3035 ms 4324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3068 ms 1700 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 416 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 416 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -