Advertisement
Rofyda_Elghadban1

Untitled

Sep 11th, 2023
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.25 KB | None | 0 0
  1.  /*Rofyda Mohamed Hamed Hamed Elghadban*/
  2.  //#include <bits/stdc++.h>
  3.  #include <iostream>
  4.  #include <iomanip>
  5.  #include <cmath>
  6.  #include <algorithm>
  7.  #include <cstdlib>
  8.  #include <limits.h>
  9.  #include <string>
  10.  #include <vector>
  11.  #include <map>
  12.  #include <stack>
  13.  #include <set>
  14.  #include <deque>
  15.  #include <fstream>
  16.  #include <bitset>
  17.  #include <cmath>
  18.  #include <numeric>
  19.  #include <cstring>
  20.  #include <utility>
  21.  #include <queue>
  22.  
  23.  /***********************************************************************************/
  24.  
  25.  #define ll long long
  26.  #define ull unsigned long long
  27.  #define pi 3.141592654
  28.  #define NUM 1e18
  29.  #define Mod  1'000'000'007
  30.  #define fixed(n) fixed<<setprecision(n)
  31.  #define cin(v) for(auto &i:v) cin >> i ;
  32.  #define cout(v) for(auto &i:v) cout << i  <<" ";
  33.  #define vowel(x) (x=='e'||x=='a'||x=='i'||x=='o'||x=='u')
  34.  #define small(x) (x>=97&&x<=122)
  35.  #define capital(x) (x>=65&&x<=90)
  36.  #define Tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
  37.  #define Toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
  38.  #define all(v) ((v).begin()), ((v).end())
  39.  #define allr(v) ((v).rbegin()), ((v).rend())
  40.  #define updmax(a,b) a=max(a,b)
  41.  #define updmin(a,b) a=min(a,b)
  42.  #define ceil(a,b) ((a/b)+(a%b?1:0))
  43.  /* asc -> 1 2 3 ,des -> 3 2 1 */
  44.  
  45.  /***********************************************************************************/
  46.  
  47.  using namespace std;
  48.  
  49.  void Rofyda_Elghadban(){
  50.   #ifndef ONLINE_JUDGE  
  51.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  52.    #endif
  53.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  54.  }
  55.  
  56.  void solve(){
  57.  }
  58.  
  59.  int main(){
  60.   Rofyda_Elghadban();
  61.  //freopen("input.txt","r",stdin);
  62.  //freopen("output.txt","r",stdout);
  63.  
  64.  int n,q;
  65.  cin>>n>>q;
  66.  vector<char>v(2*n);
  67.  cin(v);
  68.  deque<int>d;
  69.  for(int i=0;i<v.size();i++){
  70.   if(v[i]=='L'){
  71.     d.push_front(v[i+1]);
  72.   }else if(v[i]=='R'){
  73.     d.push_back(v[i+1]);
  74.   }
  75.  }
  76.  cout(d);
  77.  map<int,vector<int>>mp;
  78.  for(int i=0;i<d.size();i++){
  79.   mp[d[i]].push_back(i);
  80.  }
  81.  while(q--){
  82.   int num;
  83.   cin>>num;
  84.   for(int j=0;j<mp[num].size();j++){
  85.     if(mp[num][j]<n/2){
  86.       cout<<"Left"<<"\n";
  87.     }else{
  88.       cout<<"Right"<<"\n";
  89.     }
  90.   }cout<<"\n";
  91.  }
  92.  return 0;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement