Штуки
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
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
This commit is contained in:
62
exam-queue-17/solutions/nyatl_ok.cpp
Normal file
62
exam-queue-17/solutions/nyatl_ok.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define MAX 101000
|
||||
|
||||
int n, k;
|
||||
int a[MAX];
|
||||
map<int, int> nxt;
|
||||
map<int, int> prv;
|
||||
|
||||
int main() {
|
||||
scanf("%d %d", &n, &k);
|
||||
for (int i = 1; i <= n; i++) {
|
||||
scanf("%d", &a[i]);
|
||||
}
|
||||
for (int i = 1; i < n; i++) {
|
||||
nxt[a[i]] = a[i + 1];
|
||||
}
|
||||
for (int i = 2; i <= n; i++) {
|
||||
prv[a[i]] = a[i - 1];
|
||||
}
|
||||
int last = a[n];
|
||||
for (int i = 1; i <= k; i++) {
|
||||
int type;
|
||||
scanf("%d", &type);
|
||||
if (type == 1) {
|
||||
int x, y;
|
||||
scanf("%d %d", &x, &y);
|
||||
tie(nxt[x], prv[x], nxt[prv[y]], prv[y]) = {y, prv[y], x, x};
|
||||
} else if (type == 2) {
|
||||
int x;
|
||||
scanf("%d", &x);
|
||||
nxt[last] = x;
|
||||
prv[x] = last;
|
||||
last = x;
|
||||
} else if (type == 3) {
|
||||
int x;
|
||||
scanf("%d", &x);
|
||||
tie(nxt[prv[x]], prv[nxt[x]]) = {nxt[x], prv[x]};
|
||||
if (last == x) last = prv[x];
|
||||
nxt[x] = prv[x] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
vector<int> ans;
|
||||
int x = last;
|
||||
while (x != 0) {
|
||||
ans.push_back(x);
|
||||
x = prv[x];
|
||||
}
|
||||
printf("%d\n", (int)ans.size());
|
||||
for (int i = (int)ans.size() - 1; i >= 0; i--) {
|
||||
printf("%d ", ans[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
4
exam-queue-17/solutions/nyatl_ok.cpp.desc
Normal file
4
exam-queue-17/solutions/nyatl_ok.cpp.desc
Normal file
@@ -0,0 +1,4 @@
|
||||
File name: nyatl_ok.cpp
|
||||
Tag: ACCEPTED
|
||||
Author: Nyatl
|
||||
Change time: Mon Apr 07 21:16:54 MSK 2025
|
||||
BIN
exam-queue-17/solutions/nyatl_ok.exe
Normal file
BIN
exam-queue-17/solutions/nyatl_ok.exe
Normal file
Binary file not shown.
54
exam-queue-17/solutions/valavshonok_OK.cpp
Normal file
54
exam-queue-17/solutions/valavshonok_OK.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#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();
|
||||
}
|
||||
4
exam-queue-17/solutions/valavshonok_OK.cpp.desc
Normal file
4
exam-queue-17/solutions/valavshonok_OK.cpp.desc
Normal file
@@ -0,0 +1,4 @@
|
||||
File name: valavshonok_OK.cpp
|
||||
Tag: MAIN
|
||||
Author: valavshonok
|
||||
Change time: Tue Apr 01 00:12:51 MSK 2025
|
||||
BIN
exam-queue-17/solutions/valavshonok_OK.exe
Normal file
BIN
exam-queue-17/solutions/valavshonok_OK.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user