/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 324.0 KiB
#3 Time Exceeded ≥1078ms ≥31.973 MiB
#4 Time Exceeded ≥1088ms ≥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-11-11 02:55:38
Judged By
Score
10
Total Time
≥1088ms
Peak Memory
≥32.086 MiB