/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 327ms 2.508 MiB
#4 Accepted 710ms 7.969 MiB
#5 Accepted 1ms 320.0 KiB
#6 Time Exceeded ≥1097ms ≥1.117 MiB
#7 Time Exceeded ≥1088ms ≥1.52 MiB
#8 Accepted 309ms 1.062 MiB
#9 Time Exceeded ≥1086ms ≥2.48 MiB
#10 Accepted 254ms 7.934 MiB
#11 Time Exceeded ≥1079ms ≥2.5 MiB
#12 Time Exceeded ≥1098ms ≥2.512 MiB

Code

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

       }
       if(cn%2==1)
       {
           reverse(s.begin(),s.end());
       }
       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:37:42
Judged At
2024-10-03 13:06:42
Judged By
Score
50
Total Time
≥1098ms
Peak Memory
≥7.969 MiB