Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int i = n;
- int j = m;
- int k = 0;
- while (ans.size() != arr[n][m][0])
- {
- if (arr[i][j][k] == arr[i - 1][j - 1][k])
- --i, --j;
- else if (arr[i][j][k] == arr[i - 1][j][k])
- --i;
- else if (arr[i][j][k] == arr[i][j - 1][k])
- --j;
- else
- {
- if (s[i - 1] == ')')
- ++k;
- else
- --k;
- ans.push_back(s[i - 1]);
- --i;
- --j;
- }
- }
- for (int l = ans.size() - 1; l >= 0; --l)
- cout << ans[l];
Advertisement
Add Comment
Please, Sign In to add comment