Submission #64951594


Source Code Expand

#include<bits/stdc++.h>
#define int long long
#define mod 1000000007LL
#define endl '\n'
#define pii pair<int,int>
#define Mikari_My_Wife ios::sync_with_stdio(0),cin.tie(0);
#define all(x) x.begin(),x.end()
using namespace std;
void solve(){
    string s;
    cin>>s;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]=='W'&&s[i+1]=='A'){
            int j=i;
            while(j-1>=0&&s[j-1]=='W'){
                j--;
            }
            s[j]='A';
            for(int k=j+1;k<=i+1;k++){
                s[k]='C';
            }
        }
    }
    cout<<s<<endl;
}
signed main(){
    //注意多筆測資輸入!!!
    Mikari_My_Wife
    int t=1;
    //cin>>t;
    while(t--){solve();}
}

Submission Info

Submission Time
Task C - Debug
User zihan_ayame
Language C++ 20 (gcc 12.2)
Score 300
Code Size 731 Byte
Status AC
Exec Time 3 ms
Memory 3836 KiB

Compile Error

Main.cpp: In function ‘void solve()’:
Main.cpp:12:18: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   12 |     for(int i=0;i<s.size()-1;i++){
      |                 ~^~~~~~~~~~~

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 3428 KiB
example_01.txt AC 1 ms 3512 KiB
example_02.txt AC 1 ms 3484 KiB
hand_00.txt AC 2 ms 3584 KiB
hand_01.txt AC 2 ms 3684 KiB
hand_02.txt AC 2 ms 3732 KiB
hand_03.txt AC 2 ms 3672 KiB
hand_04.txt AC 1 ms 3364 KiB
hand_05.txt AC 1 ms 3360 KiB
hand_06.txt AC 3 ms 3676 KiB
random_00.txt AC 3 ms 3732 KiB
random_01.txt AC 3 ms 3676 KiB
random_02.txt AC 2 ms 3684 KiB
random_03.txt AC 2 ms 3676 KiB
random_04.txt AC 2 ms 3656 KiB
random_05.txt AC 2 ms 3672 KiB
random_06.txt AC 2 ms 3584 KiB
random_07.txt AC 2 ms 3692 KiB
random_08.txt AC 2 ms 3668 KiB
random_09.txt AC 2 ms 3728 KiB
random_10.txt AC 2 ms 3664 KiB
random_11.txt AC 2 ms 3740 KiB
random_12.txt AC 2 ms 3744 KiB
random_13.txt AC 2 ms 3584 KiB
random_14.txt AC 2 ms 3588 KiB
random_15.txt AC 2 ms 3724 KiB
random_16.txt AC 2 ms 3692 KiB
random_17.txt AC 2 ms 3724 KiB
random_18.txt AC 2 ms 3836 KiB
random_19.txt AC 2 ms 3664 KiB