Submission #60046541


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
char s[1000000];
int n,ans=0,res;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>s[i];
	for(int i=1;i<=n;i++){
		if(s[i]=='/'){
			res=0;
//			cout<<i<<'\n';
			while(i-res-1>0&&i+res+1<=n&&s[i-res-1]=='1'&&s[i+res+1]=='2') res++;
//			cout<<i<<'\n';
			res=res*2+1;
			ans=max(ans,res);
		}
	}
	cout<<ans;
	return 0;
}

Submission Info

Submission Time
Task C - 11/22 Substring
User zty02281128
Language C++ 20 (gcc 12.2)
Score 300
Code Size 440 Byte
Status AC
Exec Time 4 ms
Memory 3756 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 25
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, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 02_corner_00.txt, 02_corner_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3420 KiB
00_sample_01.txt AC 1 ms 3364 KiB
00_sample_02.txt AC 1 ms 3496 KiB
01_random_00.txt AC 4 ms 3620 KiB
01_random_01.txt AC 4 ms 3592 KiB
01_random_02.txt AC 4 ms 3552 KiB
01_random_03.txt AC 4 ms 3632 KiB
01_random_04.txt AC 4 ms 3652 KiB
01_random_05.txt AC 3 ms 3592 KiB
01_random_06.txt AC 3 ms 3612 KiB
01_random_07.txt AC 3 ms 3692 KiB
01_random_08.txt AC 4 ms 3552 KiB
01_random_09.txt AC 4 ms 3688 KiB
01_random_10.txt AC 3 ms 3596 KiB
01_random_11.txt AC 3 ms 3616 KiB
01_random_12.txt AC 3 ms 3696 KiB
01_random_13.txt AC 3 ms 3696 KiB
01_random_14.txt AC 3 ms 3752 KiB
01_random_15.txt AC 3 ms 3684 KiB
01_random_16.txt AC 3 ms 3696 KiB
01_random_17.txt AC 3 ms 3692 KiB
01_random_18.txt AC 3 ms 3688 KiB
01_random_19.txt AC 3 ms 3756 KiB
02_corner_00.txt AC 3 ms 3692 KiB
02_corner_01.txt AC 1 ms 3396 KiB