1 条题解

  • 0
    @ 2025-12-13 15:30:12
    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    
        int n;
        cin >> n;
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];
    
        int L1, R1, L2, R2;
        cin >> L1 >> R1 >> L2 >> R2;
    
        unordered_set<int> inB;
        for (int i = L2; i <= R2; i++) inB.insert(a[i]);
    
        bool printed = false;
        for (int i = L1; i <= R1; i++) {
            if (!inB.count(a[i])) {
                cout << a[i] << ' ';
                printed = true;
            }
        }
    
        if (!printed) cout << "void";
        return 0;
    }
    
    
    • 1

    信息

    ID
    151
    时间
    1000ms
    内存
    256MiB
    难度
    3
    标签
    (无)
    递交数
    2
    已通过
    1
    上传者