紫花开满屏,试论RE又何在

P2249 【深基13.例1】查找

thousand_godA @ 2023-08-22 15:28:46

这道题怎么又紫了!!!!!!!!!!

或许因为本人

过丑

过笨
#include<bits/stdc++.h>
using namespace std;
int a,b,c[100005];
struct sss{
    int name;
    int xb;
}d[10005];
void zcy(int l,int r,int x){
    if(l>r)return;
    int lr1 = l+(r-l)/2;
    if(c[lr1] == d[x].name){
        d[x].xb = lr1;
        zcy(l,lr1-1,x);
        return;
    }
    else if(c[lr1]>d[x].name)zcy(l,lr1-1,x);
    else zcy(lr1+1,r,x);
}
int main(){
    scanf("%d%d",&a,&b);
    for(int i = 1;i<=a;i++){
        scanf("%d",&c[i]);
    }
    for(int i = 1;i<=b;i++){
        scanf("%d",&d[i].name);
        d[i].xb = -1;
    }bool isok = true;
    for(int i = 1;i<=b;i++){
        isok = true;
        for(int j = 1;j < i;j++){
            if(d[i].name == d[j].name){
                d[i].xb = d[j].xb;
                isok == false;
                break;
            }

        }
        if(isok)zcy(1,a,i);
    }
    for(int i = 1;i<=b;i++){
        printf("%d ",d[i].xb);
    }
}

by Davis_xuzh @ 2023-08-22 15:33:28

这边的话建议您配一副眼镜


by Davis_xuzh @ 2023-08-22 15:34:02

n的范围是1e6,你写的是1e5


by Davis_xuzh @ 2023-08-22 15:34:40

m的范围是1e5,你写的是1e4


by Heartstrings @ 2023-08-22 15:34:57

好有诗意


by CarrotMeow @ 2023-08-22 15:36:53

这边的话建议您配一副眼镜。

精彩视界,从宝岛开始!眼镜精品,尽在宝岛!


by thousand_godA @ 2023-08-22 15:47:12

@Carroty_cat 对不起,我配了,200度


by thousand_godA @ 2023-08-22 15:49:54

从现在开始,标题改为:朵拉喜欢紫色,RE不爱眼镜


by thousand_godA @ 2023-08-22 15:50:56

BUT


by thousand_godA @ 2023-08-22 15:56:54

为啥TLE啊


|