답안 #1071503

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071503 2024-08-23T07:54:50 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 10612 KB
#include <bits/stdc++.h>
#define int long long
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
const int N=1e6+1;
const int inf=1e18;
const int mod=1e9+7;
using namespace std;
struct edge{
	int mn,mx,ps;
};
vector<int>v;
vector<int>v1;
signed main(){
	boost;
	int n,m;
	cin>>n>>m;
	v.push_back(0);
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		v.push_back(x);
	}
	while(m--){
		int l,r,k;
		cin>>l>>r>>k;
		if(l==r){
			cout<<1<<"\n";
			continue;
		}
		int ok=0;
		int mx=0;
		for(int i=l;i<=r;i++){
			if(i!=l){
				if(v[i]<v[i-1]&&v[i]+mx>k){
					ok=1;
					break;
				}
			}
			mx=max(mx,v[i]);
		}
		if(ok==0){
			cout<<1<<"\n";
		}else{
			cout<<0<<"\n";
		}
		v1.clear();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 306 ms 10612 KB Output is correct
2 Correct 377 ms 10428 KB Output is correct
3 Correct 332 ms 10420 KB Output is correct
4 Correct 346 ms 10168 KB Output is correct
5 Execution timed out 3032 ms 10440 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1772 ms 1496 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -