/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 540.0 KiB
#2 Wrong Answer 2ms 540.0 KiB
#3 Accepted 196ms 2.371 MiB
#4 Accepted 30ms 7.137 MiB
#5 Wrong Answer 2ms 540.0 KiB
#6 Wrong Answer 228ms 2.211 MiB
#7 Wrong Answer 213ms 1.797 MiB
#8 Wrong Answer 41ms 856.0 KiB
#9 Wrong Answer 69ms 7.895 MiB
#10 Accepted 113ms 7.734 MiB
#11 Wrong Answer 45ms 2.629 MiB
#12 Wrong Answer 41ms 7.148 MiB

Code

/**
 *  written by Binoy Barman .
**/

#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
#define all(v) v.begin(), v.end()
#define Too_Many_Jobs int tts, tc = 1; cin >> tts; hell: while(tts--)
#define Dark_Lord_Binoy ios_base::sync_with_stdio(false); cin.tie(NULL);

#ifdef LOCAL
#include "unravel.hpp"
#else
#define dbg(...) 42
#endif
#define int long long

int32_t main() {
Dark_Lord_Binoy
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    Too_Many_Jobs {
        string s;
        cin >> s;
        deque<char> pre, suf;
        int q;
        cin >> q;
        bool rev = false;
        while(q--) {
            int t;
            cin >> t;
            if(t == 1) {
                rev = rev ^ 1;
            }
            else {
                int d;
                char c;
                cin >> d >> c;
                if(!rev) {
                    if(d == 1) pre.push_front(c);
                    else suf.push_back(c);
                }
                else {
                    if(d == 2) pre.push_front(c);
                    else suf.push_back(c);
                }
            }
        }
        if(rev) {
            reverse(all(s));
            for(auto c : suf) cout << c;
            cout << s;
            for(auto c : pre) cout << c;
        }
        else {
            for(auto c : pre) cout << c;
            cout << s;
            for(auto c : suf) cout << c;
        }
        cout << nl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1088 Mr. Heart's String Challenge
Contest
Brain Booster #5
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-05 16:01:38
Judged At
2024-10-03 13:09:24
Judged By
Score
25
Total Time
228ms
Peak Memory
7.895 MiB