求助!
  • 板块灌水区
  • 楼主Deric456
  • 当前回复0
  • 已保存回复0
  • 发布时间2025/1/17 19:16
  • 上次更新2025/1/17 23:29:36
查看原帖
求助!
1365062
Deric456楼主2025/1/17 19:16

原题传送

#include<bits/stdc++.h>
using namespace std;
int m,n,x;
int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-'){
			f=-1;
		}
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return f*x;
}
int main(){	
	map<int,bool> st;
	m=read();
	n=read();
	for(int i=1;i<=m;i++){
		x=read();
		st[x]=1;
	}
	for(int i=1;i<=n;i++){
		x=read();
		if(st[x]) puts("YES");
		else puts("NO");
	}
	return 0;
}

代码

2025/1/17 19:16
加载中...