Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
23550 | 我要进前十(黄泽远) | 【二分】眼红的Medusa | C++ | 编译错误 | 0 MS | 0 KB | 412 | 2023-07-15 18:02:36 |
#include "iostream" using namespace std; int n,m,s[100005],t[100005]; int bs1(int x){ int l=0,r=m-1; while(l<r){ int mid=l+r>>1; if(t[mid]>=x)r=mid; else l=mid+1; } if(t[l]!=x)return false; return true; } int main(){ cin>>n>>m; for(int i=0;i<n;i++)cin>>s[i]; for(int i=0;i<m;i++)cin>>t[i]; sort(t,t+m); for(int i=0;i<n;i++){ if(bs1(s[i]))cout<<s[i]<<' '; } return 0; }