| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 343354 | jenkinsser | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 1012 ms | 71952 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define pii pair<int,int>
#define N 1000005
#define INF 1e9+5
#define sp " "
#define endl "\n"
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);
#define all(x) (x).begin(),(x).end()
#define ll long long
using namespace std;
int a[N], ans[N];
vector<pair<pii,int>> q[N];
int f[N];
void upd(int i, int j) {
	i = N - 1 - i;
	while (i < N) {
		f[i] = max(f[i], j);
		i |= i + 1;
	}
}
int get(int i) {
	i = N - 1 - i;
	int j = 0;
	while (i >= 0) {
		j = max(j, f[i]);
		i &= i + 1;
		i--;
	}
	return j;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 1 ; i <= n ; ++ i) cin >> a[i];
	for (int i = 1 ; i <= m ; ++ i) {
		int l, r, k;
		cin >> l >> r >> k;
		q[r].push_back({{l, k}, i});
	}
	stack<int> s;
	for (int i = 1 ; i <= n ; ++ i) {
		while (s.size() && a[s.top()] <= a[i]) s.pop();
		if (s.size()) {
			int j = s.top();
			upd(j, a[i] + a[j]);
		}
		s.push(i);
		for (int j=0;j<q[i].size();j++) {
            pair<pii,int> p=q[i][j];
			ans[p.nd] = (get(p.st.st) <= p.st.nd);
		}
	}
	for (int i = 1 ; i <= m ; ++ i) cout << ans[i] << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
