Some checks failed
Build and Push Docker Images / build (src/LiquidCode.Tester.Gateway/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-gateway-roman, gateway) (push) Successful in 1m12s
Build and Push Docker Images / build (src/LiquidCode.Tester.Worker/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-worker-roman, worker) (push) Has been cancelled
54 lines
888 B
C++
54 lines
888 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
void F() {
|
|
int n, m;
|
|
cin >> n >> m;
|
|
list<int> a;
|
|
map<int, list<int>::iterator> mp;
|
|
for (int i = 0; i < n; i++) {
|
|
int b;
|
|
cin >> b;
|
|
a.push_back(b);
|
|
mp[b] = prev(a.end());
|
|
}
|
|
while (m--) {
|
|
int t;
|
|
cin >> t;
|
|
if (t == 1) {
|
|
int x, y;
|
|
cin >> x >> y;
|
|
a.insert(mp[y], x);
|
|
mp[x] = prev(mp[y]);
|
|
}
|
|
if (t == 2) {
|
|
int x;
|
|
cin >> x;
|
|
a.push_back(x);
|
|
mp[x] = prev(a.end());
|
|
}
|
|
if (t == 3) {
|
|
int x;
|
|
cin >> x;
|
|
a.erase(mp[x]);
|
|
}
|
|
}
|
|
cout << a.size() << '\n';
|
|
for (auto i : a)
|
|
cout << i << ' ';
|
|
cout << '\n';
|
|
}
|
|
|
|
int main() {
|
|
#ifdef KRAKOZAYBRA
|
|
FILE* stream;
|
|
freopen_s(&stream, "input.txt", "r", stdin);
|
|
//freopen_s(&stream, "output.txt", "w", stdout);
|
|
#endif
|
|
cin.tie(0)->sync_with_stdio(0);
|
|
int _t = 1;
|
|
//cin >> _t;
|
|
while (_t--)
|
|
F();
|
|
} |