#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <cctype>
#include <vector>
#include <stack>
#include <bitset>
#include <set>
#include <queue>
#include <map>
using namespace std;
#define ull unsigned long long
#define ll long long
#define N 100010
ll n;
unordered_map<ll,bool> mp;
string s;
int main()
{
cin >> n;
for(int k = 0;k < n;k++)
{
ll m;
cin >> m;
for(int i = 1,x;i <= m;i++)
{
cin >> x;
if(!mp[x]) cout<<x<<" ";
mp[x] = true;
}
cout<<endl;
mp.clear();
}
return 0;
}
用map是60pts 用unordered_map直接CE
错误信息
/tmp/compiler_zolf8wn8/src:27:1: 错误:‘unordered_map’不是一个类型名
27 | unordered_map<ll,bool> mp;
| ^~~~~~~~~~~~~
/tmp/compiler_zolf8wn8/src: 在函数‘int main()’中:
/tmp/compiler_zolf8wn8/src:40:17: 错误:‘mp’ was not declared in this scope; did you mean ‘m’?
40 | if(!mp[x]) cout<<x<<" ";
| ^~
| m
/tmp/compiler_zolf8wn8/src:41:13: 错误:‘mp’ was not declared in this scope; did you mean ‘m’?
41 | mp[x] = true;
| ^~
| m
/tmp/compiler_zolf8wn8/src:44:9: 错误:‘mp’ was not declared in this scope; did you mean ‘m’?
44 | mp.clear();
| ^~
| m