Submission #1093941

# Submission time Handle Problem Language Result Execution time Memory
1093941 2024-09-28T06:26:52 Z stdfloat Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 14676 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--;

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

		cout << tr << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 20 ms 472 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 20 ms 472 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3041 ms 14676 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3044 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 20 ms 472 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 20 ms 472 KB Output isn't correct
4 Halted 0 ms 0 KB -