답안 #889786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
889786 2023-12-20T07:11:11 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e6+10;
int a[N], pref[N];
int ans[N][N];
int main(){
	int n, q;
	cin >> n >> q;
	a[0]=1e9+10;
	
	for(int i=1; i<=n; i++){
		cin>>a[i];
	}
	for(int i=1; i<=n; i++) {
		pref[i]=i-1;
		while(a[i]>=a[pref[i]]) {
			pref[i]=pref[pref[i]];
		}
	}
	for(int i=1; i<=n; i++){
		ans[i][i]=0;
		for(int j=i+1; j<=n; j++){
			ans[i][j]=ans[i][j-1];
			if(pref[j]>=i){
				ans[i][j]=max(ans[i][j], a[pref[j]] + a[j]);
			}
		}
	}
	while(q--){
		int l, r, k;
		cin >> l >> r >> k;
		if(ans[l][r]<=k){
			cout<<"1\n";
		}
		else{
			cout<<"0\n";
		}
	}
}

Compilation message

/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status