社区讨论
RE囚掉,手写哈希(vector)
P4305[JLOI2011] 不重复数字参与者 3已保存回复 4
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 4 条
- 当前快照
- 1 份
- 快照标识符
- @mmhras0k
- 此快照首次捕获于
- 2026/03/08 20:56 前天
- 此快照最后确认于
- 2026/03/08 21:05 前天
CPP
#include<bits/stdc++.h>
using namespace std;
const int inf=1e4+3;
int t,n;
int main(){
ios::sync_with_stdio(false);
cin>>t;
while(t--){
cin>>n;
vector<int> hxb[inf];
for(int i=1;i<=n;i++){
int x,xx;
cin>>x;
xx=x;
x%=inf;
x+=inf;
x%=inf;
bool f=0;
for(int i=0;i<=hxb[x].size()+1;i++){
if(hxb[x][i]==xx){
f=1;
}
}
if(f==1){
break;
}else{
hxb[x].push_back(xx);
cout<<xx<<" ";
}
}
cout<<endl;
}
return 0;
}
回复
共 4 条回复,欢迎继续交流。
正在加载回复...