/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 2ms 328.0 KiB
#3 Time Exceeded ≥1066ms ≥2.531 MiB
#4 Time Exceeded ≥1038ms ≥2.336 MiB
#5 Accepted 2ms 332.0 KiB
#6 Time Exceeded ≥1080ms ≥1.203 MiB
#7 Time Exceeded ≥1014ms ≥828.0 KiB
#8 Time Exceeded ≥1042ms ≥836.0 KiB
#9 Time Exceeded ≥1064ms ≥2.527 MiB
#10 Time Exceeded ≥1013ms ≥2.305 MiB
#11 Time Exceeded ≥1036ms ≥2.426 MiB
#12 Time Exceeded ≥1087ms ≥2.359 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-10-03 13:07:54
Judged By
Score
15
Total Time
≥1087ms
Peak Memory
≥2.531 MiB