/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 480.0 KiB
#3 Time Exceeded ≥1091ms ≥2.492 MiB
#4 Time Exceeded ≥1074ms ≥2.492 MiB
#5 Accepted 2ms 532.0 KiB
#6 Time Exceeded ≥1070ms ≥1.762 MiB
#7 Time Exceeded ≥1085ms ≥836.0 KiB
#8 Time Exceeded ≥1079ms ≥816.0 KiB
#9 Time Exceeded ≥1088ms ≥2.492 MiB
#10 Time Exceeded ≥1095ms ≥2.449 MiB
#11 Time Exceeded ≥1092ms ≥2.48 MiB
#12 Time Exceeded ≥1089ms ≥2.492 MiB

Code

#include <bits/stdc++.h>
using namespace std;
using ll=long long;

void solve() {
    string str;
    cin>>str;
    int q;
    cin>>q;
    deque<char> deq(str.begin(),str.end());

    bool rf=false;
    while(q--){
        int type;
        cin>>type;
        if(type==1){
            reverse(deq.begin(),deq.end());
        }
        else if(type==2){
            int d;cin>>d;
            char c;cin>>c;
            if(d==1){
                deq.push_front(c);
            }
            else{
                deq.push_back(c);
            }

        }
    }
    for(auto ch: deq){
        cout<<ch;
    }
    cout<<endl;

}

int main(){
    int t;
    cin>>t;
    while(t--){
        solve();
    }
return 0;
}

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:14:45
Judged At
2024-10-03 13:08:27
Judged By
Score
15
Total Time
≥1095ms
Peak Memory
≥2.492 MiB