Submission #44507290


Source Code Expand

#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,s,e) for(ll i=s;i<=e;++i)
#define FFOR(i,s,e) for(ll i=s;i>=e;--i)

#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define ALL(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define vl vector<ll>
#define vs vector<string>
#define so(a) sort(a.begin(),a.end())

#define fi first
#define se second
#define print(a) cout<<a<<endl
#define ssize(a) (ll)(a.size())

#define MAX_N 1002
#define i197 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


const ll INF=1000000000000000001;
struct edge
{
	int to, cost;
};

struct pos{
	// 1 変数を入れる;
	ll t;
	ll x,y;
	set<ll> st;

};
int dx[4] = { 1, 0, -1, 0};
int dy[4] = { 0, 1, 0, -1};
int dd[5] = { 0, 1, 0, -1, 0};

typedef pair<ll, ll> P2;
typedef pair<pair<ll,ll>,ll> P3;
typedef pair<string,ll> Ps;
typedef pair<pair<ll,ll>,pair<ll,ll> > P4;



int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	ll n;
	cin>>n;

	vector<char> s(n+1);
	rep(i,n)cin>>s[i+1];

	ll q;
	cin>>q;
	vl l(n+1);
	vl t(q+1),x(q+1);
	vector<char> c(q+1);
	rep(i,q){
		cin>>t[i+1]>>x[i+1]>>c[i+1];
		if(t[i+1]==1)l[x[i+1]]=i+1;
	}

	ll d[q+5][2]={};
	d[q+1][0]=0;
	d[q+1][1]=1;
	FFOR(i,q,1){
		d[i][0]=d[i+1][0];
		d[i][1]=d[i+1][1];
		if(t[i]==2)d[i][0]=d[i+1][1];
		if(t[i]==3)d[i][1]=d[i+1][0];
	}
	d[0][0]=d[1][0];
	d[0][1]=d[1][1];

	string ans;
	FOR(i,1,n){
		char s2;
		if(l[i]==0)s2=s[i];
		else s2=c[l[i]];

		ll a=0;
		if(islower(s2))a=1;
		a=d[l[i]][a];
		if(a==0)ans+=toupper(s2);
		else ans+=tolower(s2);
	}
	print(ans);

	return 0;
}










Submission Info

Submission Time
Task D - LOWER
User akarinkof
Language C++ 20 (gcc 12.2)
Score 400
Code Size 1990 Byte
Status AC
Exec Time 82 ms
Memory 24764 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 24
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 02_edge_22.txt, 02_edge_23.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3560 KiB
00_sample_01.txt AC 1 ms 3504 KiB
01_random_02.txt AC 70 ms 24596 KiB
01_random_03.txt AC 67 ms 24672 KiB
01_random_04.txt AC 66 ms 24496 KiB
01_random_05.txt AC 75 ms 24656 KiB
01_random_06.txt AC 82 ms 24700 KiB
01_random_07.txt AC 78 ms 24592 KiB
01_random_08.txt AC 48 ms 24748 KiB
01_random_09.txt AC 50 ms 24608 KiB
01_random_10.txt AC 48 ms 24764 KiB
01_random_11.txt AC 75 ms 24656 KiB
01_random_12.txt AC 76 ms 24588 KiB
01_random_13.txt AC 70 ms 24688 KiB
01_random_14.txt AC 48 ms 24516 KiB
01_random_15.txt AC 49 ms 24596 KiB
01_random_16.txt AC 49 ms 24592 KiB
01_random_17.txt AC 11 ms 7832 KiB
01_random_18.txt AC 34 ms 15228 KiB
01_random_19.txt AC 51 ms 22928 KiB
01_random_20.txt AC 9 ms 7000 KiB
01_random_21.txt AC 46 ms 18392 KiB
02_edge_22.txt AC 41 ms 19188 KiB
02_edge_23.txt AC 49 ms 24692 KiB