Submission #2237963


Source Code Expand

#include<iostream>
using namespace std;
string s;
int ans,now;
main()
{
	cin>>s;
	for(int i=0;i<s.size();)
	{
		while(i<s.size()&&s[i]!='2'&&s[i]!='?')i++;
		now=0;
		bool f=1;
		int h=s[i]=='?';
		for(int j=i;j<s.size();j++)
		{
			if(s[j]=='?')
			{
				if(h==1)i++;
				else h=2;
			}
			else if(s[j]=='2')
			{
				if(f)
				{
					if(h==0)i++;
					else h=2;
				}
				else break;
			}
			else if(s[j]=='5')
			{
				if(!f)
				{
					if(h==0)i++;
					else h=2;
				}
				else break;
			}
			else break;
			f=!f;
			now++;
		}
		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 0
Code Size 629 Byte
Status WA
Exec Time 2655 ms
Memory 512 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 5
AC × 20
WA × 1
TLE × 1
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 32 ms 512 KB
large_02.txt AC 410 ms 512 KB
large_03.txt TLE 2655 ms 512 KB
random_01.txt AC 6 ms 512 KB
random_02.txt WA 6 ms 512 KB
random_03.txt AC 6 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