Submission #75452090


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
const int Mod=998244353;
string s;
long long dp[3];
int main(){
    cin>>s;
    for(int i=0;i<s.size();i++){
        int x=s[i]-'a';
        long long sum=(dp[0]+dp[1]+dp[2])%Mod;
        dp[x]=(sum+1)%Mod;
    }
    cout<<(dp[0]+dp[1]+dp[2])%Mod<<endl;
}

Submission Info

Submission Time
Task D - Not Adjacent 2
User ywrow
Language C++23 (GCC 15.2.0)
Score 400
Code Size 313 Byte
Status AC
Exec Time 7 ms
Memory 3916 KiB

Compile Error

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All min.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, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
min.txt AC 1 ms 3372 KiB
random_01.txt AC 7 ms 3852 KiB
random_02.txt AC 5 ms 3708 KiB
random_03.txt AC 7 ms 3916 KiB
random_04.txt AC 3 ms 3636 KiB
random_05.txt AC 7 ms 3908 KiB
random_06.txt AC 3 ms 3784 KiB
random_07.txt AC 7 ms 3852 KiB
random_08.txt AC 3 ms 3688 KiB
random_09.txt AC 7 ms 3908 KiB
random_10.txt AC 5 ms 3712 KiB
random_11.txt AC 7 ms 3836 KiB
random_12.txt AC 1 ms 3716 KiB
random_13.txt AC 7 ms 3892 KiB
random_14.txt AC 5 ms 3700 KiB
random_15.txt AC 7 ms 3900 KiB
random_16.txt AC 3 ms 3816 KiB
random_17.txt AC 7 ms 3820 KiB
random_18.txt AC 5 ms 3652 KiB
random_19.txt AC 7 ms 3892 KiB
random_20.txt AC 2 ms 3784 KiB
random_21.txt AC 7 ms 3904 KiB
random_22.txt AC 4 ms 3652 KiB
random_23.txt AC 7 ms 3904 KiB
random_24.txt AC 2 ms 3656 KiB
random_25.txt AC 7 ms 3856 KiB
sample_01.txt AC 1 ms 3612 KiB
sample_02.txt AC 1 ms 3552 KiB