/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 4ms 532.0 KiB

Code

#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

void solve()
{
   string s; cin>>s;
   int q; cin>>q;
   bool r=false;
   for(int i=0; i<q; i++){
       int ty;
       cin>>ty;
       if(ty==1){
           r=!r;
       }
       else if(ty==2){
           int d;
           char c;
           cin>>d>>c;
           if(d==1){
               if(!r){
                   s=c+s;
               }
               else{
                   s=s+c;
               }
           }
           else if(d==2){
               if(!r){
                   s=s+c;
               }
               else{
                   s=c+s;
               }
           }
       }
   }
   if(!r){
       for(int i=s.size()-1; i>=0; i--){
           cout<<s[i];
       }
   }
    else{
         cout<<s;
   }
    cout<<endl;
}
int main()
{
    int t; cin>>t;
    while(t--)
    solve();
}

Information

Submit By
Type
Pretest
Problem
P1088 Mr. Heart's String Challenge
Language
C++17 (G++ 13.2.0)
Submit At
2024-09-05 17:08:23
Judged At
2024-09-05 17:08:23
Judged By
Score
0
Total Time
4ms
Peak Memory
532.0 KiB