Submission #46117149


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
//#define int long long
inline int read(){int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;
ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+
(x<<3)+(ch^48);ch=getchar();}return x*f;}
#define Z(x) (x)*(x)
#define pb push_back
//#define M
//#define mo
//#define N
int n, m, i, j, k, T;
char s[100010]; 

signed main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
//	srand(time(NULL));
//	T=read();
//	while(T--) {
//
//	}
	n=read(); scanf("%s", s+1); 
	for(i=1; i<=n-2; ++i) {
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') {
			printf("%d", i); exit(0); 
		}
	}
	printf("-1"); 
	return 0;
}

Submission Info

Submission Time
Task A - First ABC 2
User zhangtingxi
Language C++ 20 (gcc 12.2)
Score 100
Code Size 713 Byte
Status AC
Exec Time 1 ms
Memory 3824 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:25:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |         n=read(); scanf("%s", s+1);
      |                   ~~~~~^~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 11
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, 02_min_00.txt, 03_max_00.txt, 03_max_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3800 KiB
00_sample_01.txt AC 1 ms 3824 KiB
00_sample_02.txt AC 1 ms 3716 KiB
01_random_00.txt AC 1 ms 3620 KiB
01_random_01.txt AC 1 ms 3596 KiB
01_random_02.txt AC 1 ms 3820 KiB
01_random_03.txt AC 1 ms 3824 KiB
01_random_04.txt AC 1 ms 3700 KiB
02_min_00.txt AC 1 ms 3616 KiB
03_max_00.txt AC 1 ms 3620 KiB
03_max_01.txt AC 1 ms 3624 KiB