Submission #148799

# Submission time Handle Problem Language Result Execution time Memory
148799 2019-09-01T05:08:35 Z 욱방켜!! (twitch.tv/wookje)(#3584, kig9981, cheetose, jh05013) HicCup (FXCUP4_hiccup) C++17
24 / 100
21 ms 3328 KB
#include "hiccup.h"
#include <stack>
using namespace std;

int HicCup(std::string S) {
	int N = S.size();
	stack<int> st; // -1 H, -2 C, n !

	for(char c: S){
		if(c == '!'){
			return -1; // todo...
		}
		if(c == 'C'){
			if(st.empty()) return -1;
			st.pop();
		}
		else st.push(-1);
	}
	if(st.empty()) return 0;
	return -1;
}

Compilation message

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:6:6: warning: unused variable 'N' [-Wunused-variable]
  int N = S.size();
      ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 128 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 21 ms 3328 KB Output is correct
6 Correct 13 ms 3328 KB Output is correct
7 Correct 13 ms 3328 KB Output is correct
8 Correct 20 ms 3072 KB Output is correct
9 Correct 20 ms 3328 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 128 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 21 ms 3328 KB Output is correct
6 Correct 13 ms 3328 KB Output is correct
7 Correct 13 ms 3328 KB Output is correct
8 Correct 20 ms 3072 KB Output is correct
9 Correct 20 ms 3328 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Correct 12 ms 3328 KB Output is correct
12 Correct 13 ms 3328 KB Output is correct
13 Correct 12 ms 3328 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 13 ms 3328 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 128 KB Output is correct
18 Correct 6 ms 512 KB Output is correct
19 Incorrect 13 ms 3328 KB Output isn't correct
20 Halted 0 ms 0 KB -