Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- queue<pair<long long , long long>> queueizpair;
- pair<long long ,long long > help=make_pair(0,0);
- queueizpair.push(help);
- while (!queueizpair.empty()) {
- long long checkfirst = queueizpair.front().first, checksecond = queueizpair.front().second;
- queueizpair.pop();
- if (transition_first[checkfirst] != transition_second[checksecond]) {
- ans = false;
- break;
- }
- for (auto i = 0; i < 'z' - 'a' + 1; i++) { // по всем буковкам
- long long cur1 = firstAutomat[checkfirst][i];
- long long cur2 = secondAutomat[checksecond][i];
- if ((!path_first[cur1] || !path_second[cur2])&&(cur1!=n||cur2!=n2))
- queueizpair.push(make_pair(cur1, cur2));
- if(cur1!=n) path_first[cur1] = true;
- if(cur2!=n2)path_second[cur2] = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement