Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. #define endl "\n"
  5.  
  6. int main()
  7. {
  8.     ios_base::sync_with_stdio(false);
  9.     cin.tie(nullptr);
  10.     cout.tie(nullptr);
  11.     int t;
  12.     cin>>t;
  13.     while (t--)
  14.     {
  15.         int n;
  16.         cin>>n;
  17.         string s;
  18.         cin>>s;
  19.         int bad = 0;
  20.         for (int i = 0; i < n - 1; i++)
  21.         {
  22.             if (s[i] == '>') bad++;
  23.         }
  24.         cout<<bad + 1<<" ";
  25.         int j = 2;
  26.         int c_bad = bad;
  27.         for (int i = 0; i < n - 1; i++)
  28.         {
  29.             if (s[i] == '>')
  30.             {
  31.                 cout<<c_bad<<" ";
  32.                 c_bad--;
  33.             }
  34.             else
  35.             {
  36.                 cout<<bad + j<<" ";
  37.                 j++;
  38.             }
  39.         }
  40.         cout<<endl;
  41.        
  42.         bad = 0;
  43.         for (int i = 0; i < n - 1; i++)
  44.         {
  45.             if (s[i] == '<') bad++;
  46.         }
  47.         cout<<n - bad<<" ";
  48.         j = n;//- bad - 1;
  49.         c_bad = 1; // low
  50.         for (int i = 0; i < n - 1; i++)
  51.         {
  52.             if (s[i] == '<')
  53.             {
  54.                 int len = 0;
  55.                 int k = i;
  56.                 while (s[k] == '<')
  57.                 {
  58.                     len++;
  59.                     k++;
  60.                 }
  61.                 while(k--)
  62.                     cout<<c_bad + <<" ";
  63.                 c_bad++;
  64.  
  65.             }
  66.             else
  67.             {
  68.                 cout<<j<<" ";
  69.                 j--;
  70.             }
  71.         }
  72.         cout<<endl;    
  73.                
  74.     }
  75.     return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement