2 solutions
-
0
#pragma GCC optimize(2) #include<bits/stdc++.h> using namespace std; set<int> s; int main(){ ios_base::sync_with_stdio(false); int n,t; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&t); s.insert(t); } stringstream ss; for(auto it=s.begin();it!=s.end();it++){ ss<<*it<<" "; } cout<<ss.str(); /* for(auto it=s.begin();it!=s.end();it++){ printf("%d ",*it); } */ return 0; }
-
0
#include<iostream> #include<vector> #include<algorithm>
using namespace std;
const int N = 1e6+9;
int n,x;
vector<int> v;
int main() { cin>>n; for(int i=0;i<n;i++) { int x; cin>>x; v.push_back(x); }
sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); for(int i=0;i<v.size();i++) cout<<v[i]<<" "; cout<<endl; return 0;
}
- 1
Information
- ID
- 69
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 9
- Tags
- # Submissions
- 668
- Accepted
- 47
- Uploaded By