Submission #2555261


Source Code Expand

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include <string>
#include <cstring>
#include <cstdio>
#include<stack>
using namespace std;
int main()
{
    char s[100008]= {0};
    int i,j,n,t=0,x=0;
    scanf("%s",s);
    int l=strlen(s);
    while(777)
    {
        bool b=0,w=0;
        for(i=x; i<l; i++)
        {
            if(s[i]=='B')b=1;
            if(s[i]=='W')w=1;
        }
         if(b==0||w==0)break;
         t++;
         for(i=x;i<l;i++)
         {
             if(s[i]!=s[x])
             {
                 x=i;
                 break;
             }
         }
    }
    printf("%d\n",t);
    return 0;
}

Submission Info

Submission Time
Task C - 1D Reversi
User zhanglz100
Language C++14 (GCC 5.4.1)
Score 0
Code Size 753 Byte
Status TLE
Exec Time 2103 ms
Memory 384 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",s);
                  ^

Judge Result

Set Name sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 9
TLE × 6
Set Name Test Cases
sample sample_01.txt, sample_02.txt, sample_03.txt
All alternate_01.txt, alternate_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, same_01.txt, same_02.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt
Case Name Status Exec Time Memory
alternate_01.txt TLE 2103 ms 384 KB
alternate_02.txt TLE 2103 ms 384 KB
random_01.txt TLE 2103 ms 384 KB
random_02.txt TLE 2103 ms 384 KB
random_03.txt TLE 2103 ms 384 KB
random_04.txt TLE 2103 ms 384 KB
random_05.txt AC 1102 ms 384 KB
same_01.txt AC 1 ms 384 KB
same_02.txt AC 2 ms 384 KB
sample_01.txt AC 1 ms 384 KB
sample_02.txt AC 1 ms 384 KB
sample_03.txt AC 1 ms 384 KB
small_01.txt AC 1 ms 384 KB
small_02.txt AC 1 ms 384 KB
small_03.txt AC 1 ms 384 KB