Submission #150739

# Submission time Handle Problem Language Result Execution time Memory
150739 2019-09-01T08:52:52 Z 티셔츠 콜렉터(#3632, yoni, jisunchae, jsg1504) HicCup (FXCUP4_hiccup) C++17
0 / 100
6 ms 384 KB
#include "hiccup.h"
#include <stack>

std::stack<char> st;
int HicCup(std::string S) {
	int N = S.size();
	int res = 0;
	for (int i=0; i<N; i++) {
		if (S[i] == 'H') {
			st.push(S[i]);
		} else if (S[i] == 'C') {
			if (st.top() == 'H') {
				st.pop();
			} else {
				res = -1;
				break;
			}
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -