The_Law

Untitled

Jan 10th, 2017
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. int i = n;
  2.     int j = m;
  3.     int k = 0;
  4.  
  5.     while (ans.size() != arr[n][m][0])
  6.     {
  7.         if (arr[i][j][k] == arr[i - 1][j - 1][k])
  8.             --i, --j;
  9.         else if (arr[i][j][k] == arr[i - 1][j][k])
  10.             --i;
  11.         else if (arr[i][j][k] == arr[i][j - 1][k])
  12.             --j;
  13.         else
  14.         {
  15.             if (s[i - 1] == ')')
  16.                 ++k;
  17.             else
  18.                 --k;
  19.  
  20.             ans.push_back(s[i - 1]);
  21.             --i;
  22.             --j;
  23.         }
  24.     }
  25.  
  26.     for (int l = ans.size() - 1; l >= 0; --l)
  27.         cout << ans[l];
Advertisement
Add Comment
Please, Sign In to add comment