/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 1ms 532.0 KiB
#3 Accepted 118ms 3.375 MiB
#4 Wrong Answer 23ms 7.266 MiB
#5 Wrong Answer 1ms 324.0 KiB
#6 Wrong Answer 133ms 2.836 MiB
#7 Wrong Answer 120ms 2.586 MiB
#8 Wrong Answer 24ms 1.473 MiB
#9 Wrong Answer 41ms 7.891 MiB
#10 Accepted 70ms 7.742 MiB
#11 Wrong Answer 27ms 2.68 MiB
#12 Wrong Answer 26ms 7.652 MiB

Code

#include <iostream>
#include <cstdio>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include <functional>
#include<stdio.h>
#include<assert.h>
#include<stack>
#include<sstream>
#include <cstdlib>
#include<map>
#include<algorithm>
#include<set>
#include<utility>
#include<memory.h>
#include<string>
#include<vector>
#include<numeric>
#include <bitset>
using namespace std;
#define ll  long long
#define pb push_back
#define fi(ss) freopen (ss,"r",stdin)
#define fo(ss) freopen (ss,"w",stdout)
#define sz(v)               ((ll)((v).size()))
#define all(x)          (x).begin(),(x).end()
#define rep(i, v)       for(ll i=0;i<sz(v);i++)
#define lp(i,n) for(ll i = 0 ; i < n ; ++i)
#define lpab(i, a, b) for(ll i = a; i <= b; i++)
#define lpba(i, b, a) for(ll i = b; i >= a; i--)
#define hash ___hash
#define next ___next
#define prev ___prev
#define left ___left
#define time __time
typedef pair<ll, ll> pii;
#define F first
#define S second
#define MP make_pair
#define vi vector<ll>
#define vvi vector<vi>
#define vpii vector<pii>
#define mpii map<ll, ll> 
#define mpsi map<string, ll>
#define vs vector<string>
#define ld long double
#define vd vector<ld>
#define pie acos(-1)
const ll maxn = 4 * 100005;
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define txtio   freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define OO 1e18

int main()
{
	fastio;
	ll t;
	cin >> t;
	while (t--)
	{
		string s;
		cin >> s;
		ll q;
		cin >> q;
		ll state = 0;
		string s1 = "";
		string s2 = s1;
		while (q--)
		{
			ll n;
			cin >> n;
			if (n == 1)
			{
				state = !state;
				continue;
			}
			ll d;
			char c;
			cin >> d >> c;
			if (d == 1)
			{
				if (state)
				{
					s += c;
				}
				else
					s1 += c;
			}
			else
			{
				if (state)
					s2 += c;
				else
					s += c;
			}
		}
		if (state)
		{
			reverse(all(s));
			s += s1;
			s += s2;
		}
		else
		{
			s2 += s1;
			s2 += s;
			s = s2;
		}
		cout << s << endl;
	}
	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 15:45:41
Judged At
2024-10-03 13:10:29
Judged By
Score
20
Total Time
133ms
Peak Memory
7.891 MiB