/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 340.0 KiB
#2 Accepted 2ms 320.0 KiB
#3 Time Exceeded ≥1085ms ≥2.336 MiB
#4 Time Exceeded ≥1089ms ≥2.336 MiB

Code

#include<bits/stdc++.h>
using namespace std;
int main()
{
   int t;
   cin>>t;
   while(t--)
   {
       string s;
       cin>>s;
       long long q;
       cin>>q;
       for(long long i=1;i<=q;i++)
       {
           int a,d;
           char c;
           cin>>a;
           if(a==1)
           {
               reverse(s.begin(),s.end());
           }
           else
           {
               cin>>d>>c;
               if(d==1)
               {
                   s.insert(0,1,c);
               }
               else
               {
                   long long q=s.length();
                   s.insert(q,1,c);
               }
           }

       }
       cout<<s<<endl;
   }
}

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 16:20:07
Judged At
2024-11-11 03:00:52
Judged By
Score
10
Total Time
≥1089ms
Peak Memory
≥2.336 MiB