Submission #148358

#TimeUsernameProblemLanguageResultExecution timeMemory
148358먀 (#200)HicCup (FXCUP4_hiccup)C++17
24 / 100
20 ms3328 KiB
#include "hiccup.h"

int HicCup(std::string S) {
	int V = 0;
	for(int i=0;i<S.size();i++) {
		if(S[i] == 'H') V++;
		if(S[i] == 'C') {
			if(!V) return -1;
			V--;
		}
	}
	return (V == 0) - 1;
}

Compilation message (stderr)

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:5:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<S.size();i++) {
              ~^~~~~~~~~
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...