社区讨论
set 不是能过吗?
P4305[JLOI2011] 不重复数字参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @mhju8a9m
- 此快照首次捕获于
- 2025/11/04 08:35 4 个月前
- 此快照最后确认于
- 2025/11/04 08:35 4 个月前
为什么题解都说set被卡掉了(
以下是我通过的代码,不打算看请划走;
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
。
CPP#include<bits/stdc++.h>
#define ll long long
using namespace std;
int t,n;
int cnt;
set<int> m;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>t;
for(int o=1;o<=t;o++){
m.clear();
cin>>n;
int tmp;
for(int i=1;i<=n;i++){
cin>>tmp;
if(m.count(tmp)==0) cout<<tmp<<" ";
m.insert(tmp);
}
cout<<"\n";
}
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...