제출 #1168396

#제출 시각아이디문제언어결과실행 시간메모리
1168396Sir_Ahmed_Imran새로운 문제 (POI13_spa)C++17
25 / 100
5098 ms298552 KiB
// 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; 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, v; cin >> n >> m; bool vis[1 << n]; cin >> t, s = val(t); cin >> t, e = val(t); for(int i = 0; i < (1 << n); i++) vis[i] = 0; for(int i = 0; i < m; i++){ cin >> t; vis[val(t)] = 1; } stack<int> S; vis[s] = 1; S.push(s); while(!S.empty()){ v = S.top(); vis[v] = 1, S.pop(); for(int i = 0; i < n; i++) if(!vis[v ^ (1 << i)]){ S.push(v ^ (1 << i)); vis[v ^ (1 << i)] = 1; } } if(vis[e]) cout << "TAK"; else cout << "NIE"; } int terminator(){ L0TA; solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...