제출 #1143301

#제출 시각아이디문제언어결과실행 시간메모리
1143301Stormtrooper007Walk (POI13_spa)C++20
0 / 100
5088 ms327680 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); int n,m; cin>>n>>m; string s; string f; cin>>s>>f; map<string,bool>mp; for(int i=0;i<m;i++) { string str; cin>>str; mp[str]=1; } queue<string>q; mp[s]=1; q.push(s); int ok=0; while(!q.empty()) { string aux=q.front(); q.pop(); for(int i=0;i<n;i++) { if(aux[i]=='0') { aux[i]='1'; if(mp.find(aux)==mp.end()) { mp[aux]=1; if(aux==f) { ok=1; break; } q.push(aux); } aux[i]='0'; } else { aux[i]='0'; if(mp.find(aux)==mp.end()) { mp[aux]=1; if(aux==f) { ok=1; break; } q.push(aux); } aux[i]='1'; } } if(ok==1) break; } if(ok==0) { cout<<"NIE"; } else { cout<<"TAK"; } 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...