// 01001100 01001111 01010100 01000001 \\
// \\
// ╦ ╔═╗╔╦╗╔═╗ \\
// ║ ║ ║ ║ ╠═╣ \\
// ╩═╝╚═╝ ╩ ╩ ╩ \\
// \\
// 01001100 01001111 01010100 01000001 \\
#include <bits/stdc++.h>
using namespace std;
#define N 10000000
#define nl '\n'
#define ff first
#define ss second
#define add insert
#define ll long long
#define ld long double
#define terminator main
#define pll pair<ll,ll>
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int n, vis[N];
void dfs(int v){
vis[v] = 1;
for(int i = 0; i < n; i++)
if(!vis[v ^ (1 << i)])
dfs(v ^ (1 << i));
}
int val(string s){
int x = 0;
int m = s.size() - 1;
for(int i = 0; i <= m; i++)
if(s[i] == '1') x += 1 << (m - i);
return x;
}
void solve(){
string t;
int m, s, e;
cin >> n >> m;
cin >> t, s = val(t);
cin >> t, e = val(t);
for(int i = 0; i < m; i++){
cin >> t;
vis[val(t)] = 1;
}
dfs(s);
if(vis[e]) cout << "TAK";
else cout << "NIE";
}
int terminator(){
L0TA;
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |