Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int, int>
- #define pb(x) push_back(x)
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvl(vector <ll> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvv(vector <vector <int> > &v) {
- for (auto x : v) cv(x);
- cout << "\n";
- }
- void cvb(vector <bool> v) {
- for (bool x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvs(vector <string> v) {
- for (auto a : v) {
- cout << a << "\n";
- }
- }
- void cvp(vector <pii> a) {
- for (auto p : a) {
- cout << p.first << ' ' << p.second << "\n";
- }
- cout << "\n";
- }
- int f(int a, int b) {
- return 2 * a + b;
- }
- bool sh;
- vector <int> conv(int x) {
- vector <int> r = {-1};
- while (x > 0) {
- r.pb(x % 2);
- x /= 2;
- }
- while (r.size() < 11) {
- r.pb(0);
- }
- return r;
- }
- //индексация с 1
- vector <int> get(vector <int> x) {
- int a1, a2, a3, a4, a5, b1, b2, b3, b4, b5;
- b1 = f(x[1], x[9]) xor f(x[2], x[10]) xor f(x[3], x[8]) xor f(x[4], x[9]) xor f(x[5], x[9]) xor f(x[6], x[8]) xor f(x[7], x[8]) xor f(x[9], x[10]);
- b2 = f(x[1], x[8]) xor f(x[2], x[9]) xor f(x[3], x[10]) xor f(x[4], x[8]) xor f(x[5], x[10]) xor f(x[6], x[10]) xor f(x[7], x[8]) xor f(x[8], x[9]);
- b3 = f(x[1], x[9]) xor f(x[2], x[10]) xor f(x[3], x[8]) xor f(x[4], x[7]) xor f(x[5], x[8]) xor f(x[6], x[8]) xor f(x[7], x[8]) xor f(x[8], x[9]) xor x[10];
- b4 = f(x[1], x[7]) xor f(x[2], x[10]) xor f(x[3], x[10]) xor f(x[4], x[7]) xor f(x[5], x[7]) xor f(x[6], x[10]) xor f(x[7], x[10]) xor f(x[9], x[10]);
- b5 = f(x[1], x[8]) xor f(x[2], x[7]) xor f(x[3], x[7]) xor f(x[4], x[9]) xor f(x[5], x[9]) xor f(x[6], x[8]) xor f(x[7], x[8]) xor f(x[8], x[10]) xor x[9];
- a1 = b3 xor b4 xor b5;
- a2 = b2 xor b4 xor b5;
- a3 = b2 xor b3 xor b5;
- a4 = b1 xor b2 xor b3;
- a5 = b1 xor b3 xor b5;
- return {a1, a2, a3, a4, a5};
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- sh = 1;
- bool is = 0;
- vector <int> to = {0, 1, 0, 0, 0};
- for (int i = 0; i < pow(2, 10); ++i) {
- vector <int> a = conv(i);
- auto v = get(a);
- if (sh) {
- cv(a);
- cv(v);
- }
- if (v == to) {
- cout << "OK\n";
- is = 1;
- }
- }
- if (is) {
- cout << "OK\n";
- } else {
- cout << "NO\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement