-
-
Save fredbr/1c1064618502c94256d4a26163d19698 to your computer and use it in GitHub Desktop.
Bonecas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
const int maxn = 100001; | |
int v[maxn]; | |
int u[maxn]; | |
int main() | |
{ | |
int n; | |
cin >> n; | |
for (int i = 0; i < n; i++) cin >> v[i], u[i] = v[i]; | |
sort(u, u+n); | |
vector<int> res; | |
for (int i = 0; i < n; i++) if (v[i] != u[i]) res.push_back(v[i]); | |
sort(res.begin(), res.end()); | |
cout << res.size() << "\n"; | |
for (int i : res) cout << i << " "; | |
cout << "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment