/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 328.0 KiB
#3 Time Exceeded ≥1088ms ≥2.535 MiB
#4 Time Exceeded ≥1073ms ≥3.395 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-11-11 03:01:38
Judged By
Score
10
Total Time
≥1088ms
Peak Memory
≥3.395 MiB