Submission #150722

#TimeUsernameProblemLanguageResultExecution timeMemory
150722Solo Leveling (#200)HicCup (FXCUP4_hiccup)C++17
24 / 100
23 ms3328 KiB
#include "hiccup.h"
#include <bits/stdc++.h>
using namespace std;

struct item{
	int h , c , x;
};

int HicCup(std::string S) {
	int N = S.size();
	stack<int> s;
	bool can = true;
	for(int i = 0 ; i < N ; i ++){
		if(S[i] == 'H') s.push(i);
		else{
			if(s.empty()) can = false;
			else{
				s.pop();
			}
		}
	}
	if(s.size()) can = false;
	if(can) return 0;
	else return -1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...