/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 536.0 KiB
#3 Accepted 324ms 2.371 MiB
#4 Time Exceeded ≥1093ms ≥6.086 MiB
#5 Accepted 1ms 324.0 KiB
#6 Time Exceeded ≥1095ms ≥1.051 MiB
#7 Time Exceeded ≥1092ms ≥1.051 MiB
#8 Time Exceeded ≥1088ms ≥1.047 MiB
#9 Time Exceeded ≥1090ms ≥3.438 MiB
#10 Accepted 254ms 7.938 MiB
#11 Time Exceeded ≥1093ms ≥3.434 MiB
#12 Time Exceeded ≥1094ms ≥3.402 MiB

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
Submission
Problem
P1088 Mr. Heart's String Challenge
Contest
Brain Booster #5
Language
C++17 (G++ 13.2.0)
Submit At
2024-09-05 17:10:46
Judged At
2024-10-03 13:05:11
Judged By
Score
30
Total Time
≥1095ms
Peak Memory
≥7.938 MiB