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 cnv(char x) {
- return x - 'A';
- }
- string to(int x) {
- string r;
- while (x < 0) {
- r += x % 2 + '0';
- x /= 2;
- }
- while (r.size() < 8) {
- r += '0' ;
- }
- return r;
- }
- vector <vector <int> > m, tom;
- void bld(int a, int b) {
- string as = to(a), bs = to(b);
- m.assign(100, vector <int> (100, 0));
- int cnt = -1;
- for (int i = 3; i <= 10; ++i) {
- cnt++;
- m[i][cnv('B')] = as[cnt] - '0';
- }
- for (int j = cnv('D'); j <= cnv('J'); ++j) {
- m[2][j] = bs[cnt] - '0';
- }
- for (int j = cnv('C'); j <= cnv('J'); ++j) {
- for (int i = 3; i <= 10; ++i) {
- if (m[i - 1][cnv('C')] == 1 && m[2][cnv('D')] == 0 || m[i][cnv('B')] == 0 && m[4][j - 1] == 1) {
- m[i][j] = 1;
- }
- else {
- m[i][j] = 0;
- }
- }
- }
- if (m == tom) {
- cout << "OK\n";
- cout << a << ' ' << b << "\n";
- exit(0);
- }
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- tom.assign(100, vector <int> (100, 0));
- vector <vector <int> > get = {
- {
- 1, 0, 0, 1, 1, 1, 0, 1
- },
- {
- 1, 1, 1, 1, 1, 1, 1, 1
- },
- {
- 1, 0, 0, 1, 1, 1, 0, 1
- },
- {
- 1, 0, 0, 1, 1, 1, 0, 1
- },
- {
- 1, 0, 0, 1, 1, 1, 0, 1
- },
- {
- 1, 1, 1, 1, 1, 1, 1, 1
- },
- {
- 1, 0, 0, 1, 1, 1, 0, 1
- },
- {
- 1, 1, 1, 1, 1, 1, 1, 1
- }
- };
- int cnti = -1, cntj = -1;
- for (int i = 3; i <= 10; ++i) {
- cnti++;
- cntj = -1;
- for (int j = cnv('C'); j <= cnv('J'); ++j) {
- cntj++;
- tom[i][j] = get[cnti][cntj];
- }
- }
- for (int a = 1; a <= 255; ++a) {
- for (int b = 1; b <= 255; ++b) {
- bld(a, b);
- }
- }
- cout << "WA\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement