231142026-01-16 12:30:12khn0820G (40 pont)cpp17Wrong answer 40/4059ms1260 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m;
    cin>>n>>m;
    vector<long long int>haz(n+1, 0);
    map<long long int, int>k;
    for(int i=1; i<=n; i++){
        cin>>haz[i];
        if(haz[i-1]>haz[i] && i!=1) haz[i]=haz[i-1];
    }
    for(int i=1; i<=m; i++){
        long long int t;
        cin>>t;
        int e=1; int v=n;
        while(e!=v){
            int mi=(e+v)/2;
            if(haz[mi]<t) e=mi+1;
            else v=mi;
        }
        if(haz[e]==t) cout<<e+1<<endl;
        else cout<<e<<endl;
    }
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Wrong answer0/048ms1260 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/23ms316 KiB
6Accepted2/24ms316 KiB
7Accepted3/36ms424 KiB
8Accepted3/357ms1192 KiB
9Accepted3/359ms1200 KiB
10Accepted3/359ms1188 KiB
11Accepted4/457ms1076 KiB
12Accepted4/457ms1200 KiB
13Accepted4/459ms1200 KiB
14Accepted4/459ms1212 KiB
15Accepted4/456ms1076 KiB