Штуки
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:
52
exam-queue-17/files/val.cpp
Normal file
52
exam-queue-17/files/val.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <bits/stdc++.h>
|
||||
#include "testlib.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int minN = 1, maxN = 1e5;
|
||||
int minM = 1, maxM = 1e5;
|
||||
int minA = 1, maxA = 1e9;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
registerValidation(argc, argv);
|
||||
int n = inf.readInt(minN, maxN, "n");
|
||||
inf.readSpace();
|
||||
int m = inf.readInt(minM, maxM, "m");
|
||||
inf.readEoln();
|
||||
set<int> st;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int a = inf.readInt(minA, maxA, "a");
|
||||
if (i == n - 1)
|
||||
inf.readEoln();
|
||||
else
|
||||
inf.readSpace();
|
||||
st.insert(a);
|
||||
}
|
||||
inf.ensuref((int)st.size() == n, "a is unique");
|
||||
for (int i = 0; i < m; i++) {
|
||||
int t = inf.readInt(1, 3, "t");
|
||||
inf.readSpace();
|
||||
if (t == 1) {
|
||||
int x = inf.readInt(minA, maxA, "x");
|
||||
inf.readSpace();
|
||||
int y = inf.readInt(minA, maxA, "y");
|
||||
inf.ensuref(st.count(x) == 0, "x is already in list");
|
||||
inf.ensuref(st.count(y) == 1, "y is not in list");
|
||||
st.insert(x);
|
||||
inf.readEoln();
|
||||
}
|
||||
if (t == 2) {
|
||||
int x = inf.readInt(minA, maxA, "x");
|
||||
inf.ensuref(st.count(x) == 0, "xx is already in list");
|
||||
st.insert(x);
|
||||
inf.readEoln();
|
||||
}
|
||||
if (t == 3) {
|
||||
int x = inf.readInt(minA, maxA, "x");
|
||||
inf.ensuref(st.count(x) == 1, "x is not in list");
|
||||
st.erase(x);
|
||||
inf.readEoln();
|
||||
}
|
||||
}
|
||||
inf.readEof();
|
||||
}
|
||||
Reference in New Issue
Block a user