228812026-01-15 23:26:49BucsMate20G (40 pont)cpp17Accepted 40/4059ms2064 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<int> heights(N);
    for(int i = 0; i < N; i++){
        cin >> heights[i];
    }
    vector<int> neededHeight(N);
    neededHeight[0] = heights[0];
    for(int i = 1; i < N; i++){
        neededHeight[i] = max(neededHeight[i-1], heights[i]);
    }
    for(int i = 0; i < Q; i++){
        int currHeight;
        cin >> currHeight;
        cout << (lower_bound(neededHeight.begin(), neededHeight.end(), currHeight+1) - neededHeight.begin()) + 1 << '\n';
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Accepted0/048ms1588 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/23ms316 KiB
6Accepted2/24ms316 KiB
7Accepted3/34ms316 KiB
8Accepted3/359ms2064 KiB
9Accepted3/357ms1076 KiB
10Accepted3/359ms1872 KiB
11Accepted4/459ms1860 KiB
12Accepted4/459ms1076 KiB
13Accepted4/459ms1844 KiB
14Accepted4/459ms1848 KiB
15Accepted4/459ms1844 KiB