解法:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n, k;
cin >> n;
vector<int> arr(n);
for (auto& x : arr) cin >> x;
cin >> k;
int sum = 0;
for (auto x : arr) {
if (x == k) sum++;
}
if (sum == n) {
cout << "-1";
}
else {
for (auto x : arr) {
if (x == k) continue;
cout << x << " ";
}
}
return 0;
}