WisW
#include
using namespace std;

unordered_set s;

int main() {
        int n;
        cin >> n;
        for (int i = 0; i
                int c, x;
                scanf("%d", &c);
                s.clear();
                for (int j = 0; j
                        scanf("%d", &x);
                        if (!s.count(x)) {
                                printf("%d ", x);
                        }
                        s.insert(x);
                }
                printf("\n");
        }
        return 0;
}复制代码
#include
using namespace std;

unordered_set s;

int main() {
        int n;
        cin >> n;
        for (int i = 0; i
                int c, x;
                cin >> c;
                s.clear();
                for (int j = 0; j
                        cin >> x;
                        if (!s.count(x)) {
                                cout
                        }
                        s.insert(x);
                }
                cout
        }
        return 0;
}复制代码
前者ac, 后者后四个TLE
https://www.luogu.com.cn/problem/P4305
我猜这么一道题普及-这不至于吧
unordered set不是o(1)吗
一看, 用的cin
改成scanf秒过
()()()

第一页 上一页 下一页 最后一页