-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathABC334E.cpp
More file actions
31 lines (31 loc) · 708 Bytes
/
ABC334E.cpp
File metadata and controls
31 lines (31 loc) · 708 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
#include <bits/extc++.h>
using namespace std;
namespace pbds = __gnu_pbds;
using ui = unsigned int;
using uli = unsigned long long int;
using li = long long int;
int main(void) {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
size_t n;
cin >> n;
list<ui> a(n);
map<ui, list<ui>::iterator> mp;
for (list<ui>::iterator it = a.begin(); it != a.end(); ++it)
cin >> *it, mp[*it] = it;
size_t q;
cin >> q;
while (q--) {
char op;
ui x;
cin >> op >> x;
if (op == '1') {
ui y;
cin >> y;
mp[y] = a.insert(next(mp[x]), y);
} else if (op == '2') {
a.erase(mp[x]), mp.erase(x);
}
}
for (ui i : a) cout << i << ' ';
return 0;
}