192282025-12-01 12:05:00vargavivi20G (40 pont)cpp17Accepted 40/4059ms1268 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, q;
    cin >> n >> q;
    vector<long long> a(n);
    for (int i = 0; i < n; i ++) {
        cin >> a[i];
        if (i > 0 && a[i] < a[i - 1]) a[i] = a[i - 1];
    }
    for (int i = 0; i < q; i ++) {
        long long h; cin >> h;
        int x = upper_bound(a.begin(), a.end(), h) - a.begin();
        cout << x + 1 << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Accepted0/048ms1080 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/23ms316 KiB
6Accepted2/24ms316 KiB
7Accepted3/36ms428 KiB
8Accepted3/359ms1196 KiB
9Accepted3/359ms1200 KiB
10Accepted3/359ms1196 KiB
11Accepted4/457ms1200 KiB
12Accepted4/459ms1260 KiB
13Accepted4/459ms1240 KiB
14Accepted4/459ms1268 KiB
15Accepted4/457ms1200 KiB