Submission #1093946

# Submission time Handle Problem Language Result Execution time Memory
1093946 2024-09-28T06:30:40 Z stdfloat Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);

	int n, q;
	cin >> n >> q;

	vector<int> a(n);
	for (auto &i : a)
		cin >> i;

	while (q--) {
		int l, r, k;
		cin >> l >> r >> k; l--; r--;

		unordered_set<int> s;
		bool tr = true;
		for (int i = r; i >= l && tr; i--) {
			tr = (s.empty() || a[i] <= *s.begin() || a[i] + *--s.lower_bound(a[i]) <= k);
			s.insert(a[i]);
		}

		cout << tr << '\n';
	}
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:23:57: error: 'class std::unordered_set<int>' has no member named 'lower_bound'
   23 |    tr = (s.empty() || a[i] <= *s.begin() || a[i] + *--s.lower_bound(a[i]) <= k);
      |                                                         ^~~~~~~~~~~