Submission #149833

# Submission time Handle Problem Language Result Execution time Memory
149833 2019-09-01T07:15:10 Z (대충 적당한 팀명)(#3621, rose0310, cos18, baikdohyup) HicCup (FXCUP4_hiccup) C++17
0 / 100
24 ms 3328 KB
#include "hiccup.h"
#include <iostream>
#include <vector>

int HicCup(std::string S) {
	int N = S.size();
	int count = 0;
	int set = 0;

	std::vector<char> arr;

	for (int i = 0; i < N; i++) {
		if (!arr.empty()) {
			if (arr.back() == 'H' && S[i] == 'C') {
				arr.pop_back();
				i++;
				set++;

				while (S[i] == '!') {
					i++;
					count++;
				}
				i--;

				continue;
			}
			else if (arr.back() == 'H' && S[i] == '!') {
				return -1;
			}
			else if (arr.back() == 'H' && S[i] == 'H') {
				arr.push_back('H');
			}
		}
		else {
			if (S[i] == 'C') {
				return -1;
			}
			else if (S[i] == 'H') {
				arr.push_back('H');
			}
		}

		if (S[i] == '!' && set == 0) {
			return -1;
		}
		
		if (S[i] == '!') {
			count++;
		}
	}

	return count / set;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 24 ms 3328 KB Output is correct
6 Correct 13 ms 3200 KB Output is correct
7 Correct 16 ms 3328 KB Output is correct
8 Correct 23 ms 3328 KB Output is correct
9 Correct 23 ms 3328 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Incorrect 6 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 24 ms 3328 KB Output is correct
6 Correct 13 ms 3200 KB Output is correct
7 Correct 16 ms 3328 KB Output is correct
8 Correct 23 ms 3328 KB Output is correct
9 Correct 23 ms 3328 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Correct 15 ms 3328 KB Output is correct
12 Correct 15 ms 3328 KB Output is correct
13 Correct 13 ms 3328 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Correct 13 ms 3328 KB Output is correct
16 Correct 6 ms 384 KB Output is correct
17 Correct 6 ms 384 KB Output is correct
18 Correct 6 ms 640 KB Output is correct
19 Incorrect 15 ms 3328 KB Output isn't correct
20 Halted 0 ms 0 KB -