1 solutions
-
0
#include<bits/stdc++.h> using namespace std; const int N=62929; int T,a[105],b[105]; vector<int>haash[N]; int hs(int n){ return (n%N+N)%N; } bool not_found(int n){ if(haash[hs(n)].size()==0){ return true; } for(long unsigned int i=0;i<haash[hs(n)].size();i++){ if(haash[hs(n)][i]==n){ return false; } } return true; } int main(){ int n,cnt=0; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&a[i]); if(not_found(a[i])){ haash[hs(a[i])].push_back(a[i]); b[cnt++]=a[i]; } } sort(b,b+cnt); cout<<cnt<<'\n'; for(int i=0;i<cnt;i++){ cout<<b[i]<<' '; } return 0; }
- 1
Information
- ID
- 311
- Time
- 1000ms
- Memory
- 125MiB
- Difficulty
- 10
- Tags
- # Submissions
- 10
- Accepted
- 3
- Uploaded By