1 条题解

  • 0
    @ 2025-2-12 8:52:38
    #include<bits/stdc++.h>
    using namespace std;
    int n, m;
    map<int, bool> mapp;
    int a[101000000], b[101000000];
    int main(){
        scanf("%d%d", &n, &m);
        for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); }
        for (int i = 1; i <= m; i++) { scanf("%d", &b[i]); mapp[b[i]] = true; }
        for (int i = 1; i <= n; i++) if (mapp[a[i]]) cout << a[i] << " ";
    }
    

    map映射

    • 1

    信息

    ID
    5629
    时间
    1000ms
    内存
    125MiB
    难度
    2
    标签
    递交数
    44
    已通过
    17
    上传者