Submission #62760447


Source Code Expand

#include<bits/stdc++.h>

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 fac[N],inv[N];
int ksm(int x,int y) {
    int ans=1;
    while(y) {
        if(y&1) ans=(1ll*ans*x)%mod;
        x=(1ll*x*x)%mod; y>>=1;
    }
    return ans;
}	
__int128 mu;
inline long long reduce(__int128 x) {
	__int128 r=x-(mu*x>>64)*mod;
	return r;
}
inline void init(int ops) {
    fac[0]=1;
    mu=(__int128)(((__int128)1)<<64)/mod;
    if(!ops) return ;
    for(int i=1;i<N;i++) fac[i]=(1ll*fac[i-1]*i)%mod;
    inv[N-1]=ksm(fac[N-1],mod-2);
    for(int i=N-2;i>=0;i--) inv[i]=(1ll*inv[i+1]*(i+1))%mod;
}
inline int Inc(int x,int y) {return x+y<mod?x+y:x+y-mod;}
inline int Dec(int x,int y) {return x>=y?x-y:x-y+mod;}
inline int Mul(int x,int y) {return reduce(1ll*x*y);}
string s,t;
signed main() {
#ifndef KAxdd
#ifndef ONLINE_JUDGE
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
#endif
#endif
    cin>>s;
    int sum=0;
    for(int i=0;i<s.size();i++) {
        for(int j=i+1;j<s.size();j++) {
            for(int k=j+1;k<s.size();k++) {
                if(j-i!=k-j) continue;
                sum+=(s[i]=='A' && s[j]=='B' && s[k]=='C');
            }
        }
    }
    printf("%d\n",sum);
    return 0;
}

Submission Info

Submission Time
Task B - A..B..C
User KAddx
Language C++ 20 (gcc 12.2)
Score 200
Code Size 1816 Byte
Status AC
Exec Time 1 ms
Memory 3764 KiB

Compile Error

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 23
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3612 KiB
00_sample_01.txt AC 1 ms 3584 KiB
00_sample_02.txt AC 1 ms 3680 KiB
01_random_00.txt AC 1 ms 3752 KiB
01_random_01.txt AC 1 ms 3744 KiB
01_random_02.txt AC 1 ms 3764 KiB
01_random_03.txt AC 1 ms 3744 KiB
01_random_04.txt AC 1 ms 3636 KiB
01_random_05.txt AC 1 ms 3584 KiB
01_random_06.txt AC 1 ms 3608 KiB
01_random_07.txt AC 1 ms 3620 KiB
01_random_08.txt AC 1 ms 3572 KiB
01_random_09.txt AC 1 ms 3604 KiB
01_random_10.txt AC 1 ms 3744 KiB
02_random2_00.txt AC 1 ms 3740 KiB
02_random2_01.txt AC 1 ms 3748 KiB
02_random2_02.txt AC 1 ms 3628 KiB
02_random2_03.txt AC 1 ms 3684 KiB
03_handmade_00.txt AC 1 ms 3584 KiB
03_handmade_01.txt AC 1 ms 3744 KiB
03_handmade_02.txt AC 1 ms 3572 KiB
03_handmade_03.txt AC 1 ms 3604 KiB
03_handmade_04.txt AC 1 ms 3624 KiB