本机跑过了,但同样的数据,在AcWing上死活过不了,洛谷上也死活过不了
这是为什么呢?求大佬解答
#include<bits/stdc++.h>
using namespace std;
struct node{
int v;
node *next;
};
node* chk[100010];
void Insert(int opn){
int tmp=abs(opn)%100000;
if(chk[tmp]->v==1000000002){
chk[tmp]->v=opn;
}
else{
node* tmpnode=chk[tmp];
while(tmpnode->next!=NULL){
tmpnode=tmpnode->next;
}
tmpnode->next=new node;
tmpnode->next->v=opn;
}
}
bool find_chk(int opn){
int tmp=abs(opn)%100000;
if(chk[tmp]->v!=opn){
return false;
}
node* tmpnode=chk[tmp];
while(tmpnode->next!=NULL){
if(tmpnode->v==opn){
return true;
}
tmpnode=tmpnode->next;
}
return false;
}
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<100010;i++){
chk[i]=new node;
chk[i]->v=1000000002;
}
char opr;
int opn;
for(int y=0;y<n;y++){
cin>>opr;
scanf("%d",&opn);
if(opr=='I'){
Insert(opn);
}
else{
if(find_chk(opn)){
printf("Yes\n");
}
else{
printf("No\n");
}
}
}
return 0;
}