9048 科技创新大赛

#include<bits/stdc++.h>
#define f(i,s,e) for(int i = s; i <= e; i++)
#define ll long long
using namespace std;
const int N = 1e6+10,inf = 0x3f3f3f3f;
int n,m;
int a[N],b[N],vis[N];
int main()
{
    cin >> n >> m;
    f(i,1,n) cin >> a[i];
    f(i,1,m) cin >> b[i];
    f(i,1,n)
        f(j,1,m)
            if(a[i] == b[j] && vis[a[i]] == 0)
                cout << a[i] << " ",vis[a[i]] = 1;
                
    return 0;
}

 

posted @ 2024-06-28 14:48  CRt0729  阅读(29)  评论(0编辑  收藏  举报