AcWing 5065. 排序去重
原题链接
简单
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 1e6+10;
int t,n,m,k,l,r,op,x,y;
int f[N];
bool flag;
//int dp[N][N];
void solve(){
cin>>n;
for(int i = 1;i<=n;i++){
cin>>f[i];
}
sort(f+1,f+1+n);
for(int i = 1;i<=n;i++){
cout<<f[i]<<" ";
}
cout<<"\n";
f[0] = 0x3f3f3f3f;
for(int i = 1;i<=n;i++){
if(f[i]!=f[i-1]){
cout<<f[i]<<" ";
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}