1 solutions
-
0
#include <bits/stdc++.h> #include <stack> using namespace std; const int N=1e8+9; int a[N]; void sort_1(int l,int r) { for(int i=l;i<=r;i++) { for(int j=i;j<=r;j++) { if(a[i]<a[j]) swap(a[i],a[j]); } } } int main() { int n; cin>>n; stack<int> q; for(int i=1;i<=n;i++) { cin>>a[i]; } sort_1(1,n); for(int i=1;i<=n;i++) { if(a[i]!=a[i+1]) q.push(a[i]); } cout<<q.size()<<endl; while(!q.empty()) { cout<<q.top()<<endl; q.pop(); } return 0; }
Information
- ID
- 523
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- 10
- Tags
- # Submissions
- 5
- Accepted
- 5
- Uploaded By