/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 2ms 532.0 KiB
#3 Time Exceeded ≥1084ms ≥2.34 MiB
#4 Time Exceeded ≥1087ms ≥3.395 MiB
#5 Accepted 2ms 532.0 KiB
#6 Time Exceeded ≥1063ms ≥1.047 MiB
#7 Time Exceeded ≥1084ms ≥1016.0 KiB
#8 Time Exceeded ≥1087ms ≥1.004 MiB
#9 Time Exceeded ≥1076ms ≥3.395 MiB
#10 Time Exceeded ≥1067ms ≥2.285 MiB
#11 Time Exceeded ≥1090ms ≥3.402 MiB
#12 Time Exceeded ≥1092ms ≥3.402 MiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back

void judge()
{
  #ifndef ONLINE_JUDGE
  freopen("error.txt", "w", stderr);
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
 
}

const ll N=2e5 +5;

void soln(){
	string s;
	cin>>s;
	int q;
	cin>>q;
	while(q--){
		int t;
		cin>>t;
		if(t==1){
			reverse(s.begin(),s.end());
		}
		else{
			int a;
			char c;
			cin>>a>>c;
			if(a==1){
				s= c+s;
			}
			else{
				s= s+c;
			}
		}
	}
	cout<<s<<endl;
}

int main() {
	// judge();
    int t;
    cin >> t;

    while (t--) soln();
}

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:07:23
Judged At
2024-10-03 13:08:57
Judged By
Score
15
Total Time
≥1092ms
Peak Memory
≥3.402 MiB