Submission #63015074
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;namespace SOLUTION{constexpr int maxn=3e5+5;char str[maxn];inline int Main(){cin>>str;int n=strlen(str);for(int i=0;i<n;++i){if(str[i]=='W'&&str[i+1]=='A'){int now=i;while(now>=0&&str[now]=='W'&&str[now+1]=='A'){str[now]='A';str[now+1]='C';--now;}}}cout<<str<<"\n";return 0;}
#include<bits/stdc++.h> using namespace std; namespace SOLUTION{ constexpr int maxn=3e5+5; char str[maxn]; inline int Main(){ cin>>str; int n=strlen(str); for(int i=0;i<n;++i){ if(str[i]=='W'&&str[i+1]=='A'){ int now=i; while(now>=0&&str[now]=='W'&&str[now+1]=='A'){ str[now]='A'; str[now+1]='C'; --now; } } } cout<<str<<"\n"; return 0; } } int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); SOLUTION::Main(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Debug |
User | sangshang |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 664 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 3868 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 3432 KB |
example_01.txt | AC | 1 ms | 3484 KB |
example_02.txt | AC | 1 ms | 3472 KB |
hand_00.txt | AC | 2 ms | 3668 KB |
hand_01.txt | AC | 2 ms | 3700 KB |
hand_02.txt | AC | 2 ms | 3780 KB |
hand_03.txt | AC | 2 ms | 3800 KB |
hand_04.txt | AC | 1 ms | 3628 KB |
hand_05.txt | AC | 1 ms | 3504 KB |
hand_06.txt | AC | 2 ms | 3664 KB |
random_00.txt | AC | 2 ms | 3728 KB |
random_01.txt | AC | 2 ms | 3800 KB |
random_02.txt | AC | 2 ms | 3868 KB |
random_03.txt | AC | 2 ms | 3796 KB |
random_04.txt | AC | 2 ms | 3796 KB |
random_05.txt | AC | 2 ms | 3700 KB |
random_06.txt | AC | 2 ms | 3864 KB |
random_07.txt | AC | 2 ms | 3740 KB |
random_08.txt | AC | 2 ms | 3808 KB |
random_09.txt | AC | 2 ms | 3700 KB |
random_10.txt | AC | 2 ms | 3728 KB |
random_11.txt | AC | 2 ms | 3724 KB |
random_12.txt | AC | 2 ms | 3724 KB |
random_13.txt | AC | 2 ms | 3860 KB |
random_14.txt | AC | 2 ms | 3856 KB |
random_15.txt | AC | 2 ms | 3848 KB |
random_16.txt | AC | 2 ms | 3864 KB |
random_17.txt | AC | 2 ms | 3796 KB |
random_18.txt | AC | 2 ms | 3800 KB |
random_19.txt | AC | 2 ms | 3796 KB |