Submission #149132

#TimeUsernameProblemLanguageResultExecution timeMemory
149132bitKOIn (#200)HicCup (FXCUP4_hiccup)C++17
24 / 100
21 ms3328 KiB
#include "hiccup.h"

int HicCup(std::string S) {
	int N = S.size();
	//if(N)
	int a=0;
	for(int t=0;t<N;t++)
    {
        if(S[t]=='H') a++;
        else a--;
        if(a<0) return -1;
    }
    if(a)
	return -1;
	return 0;
}

Compilation message (stderr)

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:13:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if(a)
     ^~
hiccup.cpp:15:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  return 0;
  ^~~~~~
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...