File tree 1 file changed +71
-0
lines changed
1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ // ॐ नमः शिवाय
2
+ #include < bits/stdc++.h>
3
+ using namespace std ;
4
+
5
+ #define ll long long
6
+ #define pb push_back
7
+ #define ff first
8
+ #define ss second
9
+ #define mp make_pair
10
+
11
+ // Code Written By: Vikash Patel
12
+ // Codeforces Profile: https://codeforces.com/profile/vikashpatel
13
+
14
+ int orginalPos (int a, string m)
15
+ {
16
+ for (auto i : m)
17
+ {
18
+ if (i == ' D' )
19
+ {
20
+ if (a == 9 )
21
+ a = 0 ;
22
+ else
23
+ a++;
24
+ }
25
+ else
26
+ {
27
+ if (a == 0 )
28
+ a = 9 ;
29
+ else
30
+ a--;
31
+ }
32
+ }
33
+ return a;
34
+ }
35
+
36
+ int main ()
37
+ {
38
+ ios_base::sync_with_stdio (0 );
39
+ cin.tie (0 );
40
+ cout.tie (0 );
41
+
42
+ // #ifndef ONLINE_JUDGE
43
+ // freopen("input.txt", "r", stdin);
44
+ // freopen("/Users/vikash/Desktop/output.txt", "w", stdout);
45
+ // #endif
46
+
47
+ int t;
48
+ cin>>t;
49
+ while (t--)
50
+ {
51
+ int n;
52
+ cin>>n;
53
+ int a[n], b[n];
54
+ for (int i=0 ; i<n; i++)
55
+ {
56
+ cin>>a[i];
57
+ }
58
+ string s[n];
59
+ int moves[n];
60
+ for (int i=0 ; i<n; i++)
61
+ {
62
+ cin>>b[i]>>s[i];
63
+ }
64
+ for (int i=0 ; i<n; i++)
65
+ {
66
+ cout<<orginalPos (a[i], s[i])<<" " ;
67
+ }
68
+ cout<<endl;
69
+ }
70
+ return 0 ;
71
+ }
You can’t perform that action at this time.
0 commit comments