Submission #63014822


Source Code Expand

#include<bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
namespace IO{
    template<typename T>
    void read(T &x){
        char ch=getchar();int fl=1;x=0;
        while(ch>'9'||ch<'0'){if(ch=='-')fl=-1;ch=getchar();}
        while(ch<='9'&&ch>='0'){x=x*10+ch-48;ch=getchar();}
        x*=fl;
    }
    template<typename T,typename ...Args>
    void read(T &x,Args& ...args){
        read(x);read(args...);
    }
    template <typename _Tp>
    void write(_Tp x) {
        if(x<0) x=(~x+1),putchar('-');
        if(x>9) write(x/10);
        putchar(x%10+'0');
    }
}
using namespace std;
using namespace IO;
const int N=2e5+5,mod=998244353;
int n;
string s;
set<int> S;
signed main() {
	cin>>s;n=s.size();
	s=" "+s;
	for(int i=1;i<=n;i++) {
		if(s[i]=='W' && s[i+1]=='A') S.insert(i);
	} 
	while(!S.empty()) {
		int p=(*S.begin());
		s[p]='A'; s[p+1]='C';
		if(s[p-1]=='W') S.insert(p-1);
		S.erase(p);
		
	}
	for(int i=1;i<=n;i++) printf("%c",s[i]);
    return 0;
}

Submission Info

Submission Time
Task C - Debug
User KAddx
Language C++ 20 (gcc 12.2)
Score 300
Code Size 1062 Byte
Status AC
Exec Time 26 ms
Memory 4800 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 30
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3492 KiB
example_01.txt AC 1 ms 3572 KiB
example_02.txt AC 1 ms 3368 KiB
hand_00.txt AC 19 ms 3880 KiB
hand_01.txt AC 10 ms 3800 KiB
hand_02.txt AC 18 ms 3876 KiB
hand_03.txt AC 10 ms 3976 KiB
hand_04.txt AC 1 ms 3572 KiB
hand_05.txt AC 1 ms 3436 KiB
hand_06.txt AC 14 ms 3948 KiB
random_00.txt AC 26 ms 4800 KiB
random_01.txt AC 26 ms 4764 KiB
random_02.txt AC 20 ms 3896 KiB
random_03.txt AC 18 ms 3796 KiB
random_04.txt AC 18 ms 3888 KiB
random_05.txt AC 14 ms 3892 KiB
random_06.txt AC 14 ms 3884 KiB
random_07.txt AC 16 ms 3884 KiB
random_08.txt AC 16 ms 3864 KiB
random_09.txt AC 14 ms 3892 KiB
random_10.txt AC 18 ms 3872 KiB
random_11.txt AC 15 ms 3880 KiB
random_12.txt AC 17 ms 3880 KiB
random_13.txt AC 17 ms 3876 KiB
random_14.txt AC 14 ms 3892 KiB
random_15.txt AC 12 ms 3872 KiB
random_16.txt AC 11 ms 3896 KiB
random_17.txt AC 13 ms 3908 KiB
random_18.txt AC 18 ms 3896 KiB
random_19.txt AC 16 ms 3916 KiB