what

P4305 [JLOI2011] 不重复数字

多测不清空,宝灵泪两行
by Regenbogen_71 @ 2023-09-03 15:42:29


@[wangjingtian1](/user/1004343) 1. 多测不清零,不换行; 2. 输入输出量大,记得关流同步; 3. bool 不能 ++。 ```cpp #include <bits/stdc++.h> using namespace std; map<int,bool> a;//没必要开 long long int s[1000000]; int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);//关流同步,给cin,cout加速 int n; cin>>n; for(int i=0;i<n;i++){ int b; cin>>b; a.clear();//清空 for(int j=0;j<b;j++){ cin>>s[j]; a[s[j]] = 1; }for(int j=0;j<b;j++){ if(a[s[j]]){ cout<<s[j]<<" "; a[s[j]]=0; } } cout<<'\n'; } } ```
by small_john @ 2023-09-03 15:42:57


非要用C++?用python五行完事
by mryafeng @ 2023-09-04 23:32:42


|