230252026-01-16 10:50:53Gervid20G (40 pont)cpp17Wrong answer 0/4017ms1852 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits.h>
#include <algorithm>
#include <math.h>
#include <array>

using namespace std;
using ll = long long;

signed main()
{
	iostream::sync_with_stdio(0);
	cin.tie(0);

	int n, q;
	cin >> n >> q;
	vector<int> houses(n);
	for (int i = 0; i < n; i++) cin >> houses[i];

	vector<array<int, 2>> h; //ascending in heights by leaving out elements {height, origIdx}
	h.reserve(n);
	h.push_back({houses[0], 0});
	for (int i = 1; i < n; i++) {
		if (houses[i] <= h.back()[0]) continue;
		h.push_back({ houses[i], i });
	}

	while (q--) {
		int m;
		cin >> m;
		array<int, 2> v = { m, INT_MAX };
		cout << lower_bound(h.begin(), h.end(), v).operator*()[1] + 1;
	}
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/01ms316 KiB
2Wrong answer0/013ms844 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms500 KiB
7Wrong answer0/31ms428 KiB
8Wrong answer0/316ms1600 KiB
9Wrong answer0/316ms1548 KiB
10Wrong answer0/316ms1852 KiB
11Wrong answer0/416ms1588 KiB
12Wrong answer0/416ms1608 KiB
13Wrong answer0/417ms1604 KiB
14Wrong answer0/416ms1588 KiB
15Wrong answer0/416ms1588 KiB