Submission #2237993


Source Code Expand

#include<iostream>
using namespace std;
string s;
int ans,now,f=1;
main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(f)
		{
			if(s[i]=='2'||s[i]=='?')now++;
			else now=0;
		}
		else
		{
			if(s[i]=='5'||s[i]=='?')now++;
			else now=0;
		}
		f=!f;
		if(now==1&&i%2==1)now=0;
		ans=ans<now?now:ans;
	}
	f=1;
	now=0;
	for(int i=1;i<s.size();i++)
	{
		if(f)
		{
			if(s[i]=='2'||s[i]=='?')now++;
			else now=0;
		}
		else
		{
			if(s[i]=='5'||s[i]=='?')now++;
			else now=0;
		}
		f=!f;
		if(now==1&&i%2==0)now=0;
		ans=ans<now?now:ans;
	}
	cout<<(ans/2*2)<<endl;
}

Submission Info

Submission Time
Task B - ニコニコレベル
User kotatsugame
Language C++14 (GCC 5.4.1)
Score 300
Code Size 610 Byte
Status AC
Exec Time 6 ms
Memory 512 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 5
AC × 22
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, large_01.txt, large_02.txt, large_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
Case Name Status Exec Time Memory
hand_01.txt AC 1 ms 256 KB
hand_02.txt AC 1 ms 256 KB
hand_03.txt AC 1 ms 256 KB
hand_04.txt AC 1 ms 256 KB
hand_05.txt AC 5 ms 512 KB
large_01.txt AC 6 ms 512 KB
large_02.txt AC 6 ms 512 KB
large_03.txt AC 6 ms 512 KB
random_01.txt AC 6 ms 512 KB
random_02.txt AC 5 ms 512 KB
random_03.txt AC 5 ms 512 KB
random_04.txt AC 6 ms 512 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sample_04.txt AC 1 ms 256 KB
sample_05.txt AC 1 ms 256 KB