-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBEE-2460.cpp
More file actions
43 lines (33 loc) · 695 Bytes
/
Copy pathBEE-2460.cpp
File metadata and controls
43 lines (33 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> ids(n);
for (int i = 0; i < n; i++) {
int id;
cin >> id;
ids[i] = id;
}
int m;
cin >> m;
for (int i = 0; i < m; i++) {
int id;
cin >> id;
for (int j = 0; j < n; j++) {
if (ids[j] != id) continue;
ids.erase(ids.begin() + j);
break;
}
}
for (int i = 0; i < ids.size() - 1; i++) {
int id = ids[i];
if (id != 0) cout << id << " ";
}
int last_id = ids.back();
if (last_id != 0) cout << last_id;
cout << "\n";
return 0;
}