Submission #75418658


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

#define int long long 

const int N=3e5+5,mod=998244353;

bool st;
string s;
int ans;
bool ed;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cerr<<(double)(&st-&ed)/1024/1024<<'\n';
	cin>>s;
	int last=1;ans+=1;
	for(int i=1;i<s.length();i++) {
		if(s[i]==s[i-1]) last=1,(ans+=1)%=mod;
		else last++,(ans+=last)%=mod;
	}cout<<ans<<'\n';
	return 0;
}

Submission Info

Submission Time
Task C - Not Adjacent
User wallacewan
Language C++23 (GCC 15.2.0)
Score 300
Code Size 444 Byte
Status AC
Exec Time 2 ms
Memory 4436 KiB

Compile Error

./Main.cpp: In function 'int main()':
./Main.cpp:19:22: 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]
   19 |         for(int i=1;i<s.length();i++) {
      |                     ~^~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
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 3744 KiB
random_01.txt AC 2 ms 4028 KiB
random_02.txt AC 2 ms 3876 KiB
random_03.txt AC 2 ms 4128 KiB
random_04.txt AC 1 ms 3960 KiB
random_05.txt AC 2 ms 4228 KiB
random_06.txt AC 1 ms 3988 KiB
random_07.txt AC 2 ms 4072 KiB
random_08.txt AC 1 ms 3980 KiB
random_09.txt AC 2 ms 4436 KiB
random_10.txt AC 2 ms 4068 KiB
random_11.txt AC 2 ms 4232 KiB
random_12.txt AC 1 ms 3756 KiB
random_13.txt AC 2 ms 4068 KiB
random_14.txt AC 2 ms 3972 KiB
random_15.txt AC 2 ms 4268 KiB
random_16.txt AC 1 ms 3928 KiB
random_17.txt AC 2 ms 4024 KiB
random_18.txt AC 2 ms 3972 KiB
random_19.txt AC 2 ms 4268 KiB
random_20.txt AC 1 ms 3980 KiB
random_21.txt AC 2 ms 4128 KiB
random_22.txt AC 2 ms 4004 KiB
random_23.txt AC 2 ms 4068 KiB
random_24.txt AC 1 ms 3908 KiB
random_25.txt AC 2 ms 4308 KiB
sample_01.txt AC 1 ms 3756 KiB
sample_02.txt AC 1 ms 3628 KiB