Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- //*****************Data type**********************//
- typedef long long ll;
- typedef long long int lli;
- typedef unsigned long long ull;
- typedef unsigned long long int ulli;
- //*****************Map****************************//
- typedef map<int, int> mp;
- typedef map<int, string> mps;
- typedef map<int, char>mpc;
- typedef map<string, int>mpsi;
- typedef map<char, int>mpci;
- //****************Pair****************************//
- typedef pair<int, int> pii;
- typedef pair<string, string> pss;
- typedef pair<char, char> pcc;
- typedef pair<int, string> pis;
- typedef pair<int, char> pic;
- //*****************Vector************************//
- typedef vector<int> VI;
- typedef vector<string> VS;
- typedef vector<double> VD;
- typedef vector<lli> VLLI;
- typedef vector<VI> VVI;
- typedef vector<pii> VPI;
- //-------------------------------------------------------------------------------//
- #define pp1(A) printf("%d\n",A)
- #define pp2(A,B) printf("%d %d\n",A,B)
- #define pp3(A,B,C) printf("%d %d %d\n",A,B,C)
- #define ss1(A) scanf("%d", &A)
- #define ssl(A) scanf("%lld", &A)
- #define ss2(A,B) scanf("%d,%d",&A,&B)
- #define ss3(A,B,C) scanf("%d,%d,%d",&A,&B,&C)
- //--------------------------------------------------------------------------------//
- #define nosync ios_base::sync_with_stdio(false), cin.tie(NULL)
- #define pf push_front
- #define pb push_back
- #define popp pop_back()
- #define itr iterator
- #define mk make_pair
- #define ff first
- #define ss second
- #define END return 0
- #define line printf("\n")
- #define sq(a) (a)*(a)
- #define SZ(a) (int)a.size()
- #define all(a) (a).begin(), (a).end()
- #define Erase(V,I) (V).erase((V).begin()+I)
- #define Insert(V,I,M) (V).insert((V).begin()+I,M)
- #define READ() freopen("input.txt", "r", stdin)
- #define WRITE() freopen("output.txt", "w", stdout)
- //********************************************************************************//
- #define loop(i,n) for(int i=0;i<n;i++)
- #define loop2(i,n) for(int i=n-1;i>=0;i--)
- #define loop3(i,t) for(int i=1;i<=t;i++)
- #define scanV(V, N) for(int i=0; i<N; i++){ int X; ss1(X); V.pb(X); }
- #define scanVll(V, N) for(int i=0; i<N; i++){ lli X; ssl(X); V.pb(X); }
- #define scanA(A, N) for(int i=0; i<N; i++){ ss1(A[i]); }
- #define scanAll(A, N) for(int i=0; i<N; i++){ ssl(A[i]); }
- #define printA(A, N) for(int i=0; i<N; i++){ cout<<A[i]; if (i<N-1)cout<<" ";else cout<<endl; }
- #define vout(v) for(int i = 0; i < v.size(); i++) {cout << v[i]; if(i < v.size() - 1) cout <<" "; else cout << endl;}
- /*-----------------------GCD && LCM------------------*/
- int gcd(int a, int b)
- {
- return b == 0 ? a : gcd(b, a % b);
- }
- int lcm(int a, int b)
- {
- return a * (b / gcd(a, b));
- }
- /*---------------------------------------------------*/
- //---------------------------------*START*-----------------------------------------//
- char left1(char s)
- {
- if(s=='<')
- s='v';
- else if(s=='^')
- s='<';
- else if(s=='>')
- s='^';
- else if(s=='v')
- s='>';
- return s;
- }
- char right1(char s)
- {
- if(s=='<')
- s='^';
- else if(s=='>')
- s='v';
- else if(s=='^')
- s='>';
- else if(s=='v')
- s='<';
- return s;
- }
- void same(string s[],int len)
- {
- //line;
- loop(i,len)
- {
- loop(j,len)
- {
- cout<<s[i][j];
- }
- line;
- }
- }
- void Right(string s[],int len)
- {
- string s1[len],s2[len];
- loop(i,len)
- {
- loop(j,len)
- {
- s2[i][j]=s[i][j];
- s1[j]+=s[i][j];
- }
- }
- //line;
- loop(i,len)
- {
- reverse(s1[i].begin(),s1[i].end());
- loop(j,len)
- {
- if(s1[i][j]=='<')
- s1[i][j]='^';
- else if(s1[i][j]=='>')
- s1[i][j]='v';
- else if(s1[i][j]=='^')
- s1[i][j]='>';
- else if(s1[i][j]=='v')
- s1[i][j]='<';
- cout<<s1[i][j];
- }
- line;
- }
- }
- int main()
- {
- int n;
- string s;
- cin>>n>>s;
- string s1[n];
- loop(i,n)cin>>s1[i];
- int len=s.size();
- char result=s1[0][0];
- //cout<<result<<endl;
- if(n==1)
- {
- loop(i,len)
- {
- if(s[i]=='L')
- {
- result=left1(result);
- }
- else
- {
- result=right1(result);
- }
- }
- cout<<result<<endl;
- END;
- }
- if(len%2==0)
- {
- same(s1,n);
- }
- else
- {
- Right(s1,n);
- }
- END;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement