/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 476.0 KiB
#3 Accepted 109ms 2.379 MiB
#4 Time Exceeded ≥1088ms ≥7.297 MiB
#5 Accepted 1ms 324.0 KiB
#6 Time Exceeded ≥1094ms ≥1.684 MiB
#7 Time Exceeded ≥1075ms ≥1.645 MiB
#8 Accepted 950ms 1.574 MiB
#9 Time Exceeded ≥1088ms ≥3.539 MiB
#10 Accepted 69ms 7.867 MiB
#11 Time Exceeded ≥1098ms ≥3.605 MiB
#12 Time Exceeded ≥1086ms ≥3.625 MiB

Code

#include<bits/stdc++.h>
#include <functional>
using namespace std;

#define ll long long
#define nl "\n"
#define ws " "
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007

typedef vector<int> vi;
typedef vector<pair<ll, ll>> vii;

int main () {
    FASTIO
    int t;
    cin>>t;
    while (t--) {
        string s;
        cin>>s;
        int q;
        cin>>q;
        int cnt = 0;
        while (q--) {
            int op;
            cin>>op;
            if (op == 1) {
                cnt++;
            } else {
                int d;
                char c;
                cin>>d>>c;
                if (d == 1) {
                    if (cnt % 2 == 0) {
                        s = c + s;
                    } else {
                        s.push_back (c);
                    }
                } else {
                    if (cnt % 2 == 0) {
                        s.push_back (c);
                    } else {
                        s = c + s;
                    }
                }
            }
        }
        if (cnt & 1) {
            reverse (s.begin(), s.end());
        }
        cout<<s<<nl;
    }
    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:04:18
Judged At
2024-10-03 13:09:11
Judged By
Score
40
Total Time
≥1098ms
Peak Memory
≥7.867 MiB