60分求调
查看原帖
60分求调
1160851
chengkelin2024楼主2024/11/19 21:54
#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main() {
    int n;
    int a, sum = 0;
    cin >> a;
    for (int sum = 0; sum < a; sum++) {
        cin >> n;
        int aaa = 0;
        for (int i = 1; i <= n; i++) {
            long long aa;
            cin >> aa;
            if (!mp.count(aa) || (mp[aa] != sum)) {
                if (aaa == 0) {
                    aaa = 1;
                } else {
                    cout << " ";
                }
                cout << aa;
                mp[aa] = sum;
            }
        }
        cout << endl; 
    }
    return 0;
}

爆TLE了

2024/11/19 21:54
加载中...