/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Time Exceeded ≥1097ms ≥31.938 MiB
#4 Time Exceeded ≥1096ms ≥32.09 MiB
#5 Accepted 1ms 540.0 KiB
#6 Time Exceeded ≥1099ms ≥10.613 MiB
#7 Time Exceeded ≥1099ms ≥4.629 MiB
#8 Time Exceeded ≥1100ms ≥6.027 MiB
#9 Time Exceeded ≥1098ms ≥32.086 MiB
#10 Time Exceeded ≥1100ms ≥32.191 MiB
#11 Time Exceeded ≥1102ms ≥32.098 MiB
#12 Time Exceeded ≥1099ms ≥32.086 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define print(v) for(auto &u:v) cout << u << " "
#define printp(v) for(auto e:v) cout<<e.first<<" "<<e.second<<endl;
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define pb push_back
#define printl(li) for(auto &u:li) cout << u;
 
void solve()
{ 
   string str; cin >> str;
   list <char> li;
   for(int i=0; i<str.size(); i++) li.pb(str[i]);
   int q; cin >> q;
     bool flag = true;
   while(q--){
      int check; cin >> check;

      if(check==2)
      {
         int d; cin >> d;
         char ch; cin >> ch;
         d==1 ? li.push_front(ch) : li.push_back(ch);
      }
      else if(check == 1){
         li.reverse();
      }

   }
   printl(li);
   cout << endl;
 
}
 
int main()
{   
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1; cin >> t;
    while(t--)
    {
       solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1088 Mr. Heart's String Challenge
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-07 08:53:19
Judged At
2024-09-07 08:53:19
Judged By
Score
15
Total Time
≥1102ms
Peak Memory
≥32.191 MiB