Submission #149824

# Submission time Handle Problem Language Result Execution time Memory
149824 2019-09-01T07:14:06 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] == '!') {
				std::cout << "���";
				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 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 24 ms 3328 KB Output is correct
6 Correct 13 ms 3328 KB Output is correct
7 Correct 12 ms 3328 KB Output is correct
8 Correct 24 ms 3328 KB Output is correct
9 Correct 23 ms 3200 KB Output is correct
10 Correct 14 ms 3328 KB Output is correct
11 Incorrect 6 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 24 ms 3328 KB Output is correct
6 Correct 13 ms 3328 KB Output is correct
7 Correct 12 ms 3328 KB Output is correct
8 Correct 24 ms 3328 KB Output is correct
9 Correct 23 ms 3200 KB Output is correct
10 Correct 14 ms 3328 KB Output is correct
11 Correct 15 ms 3328 KB Output is correct
12 Correct 14 ms 3328 KB Output is correct
13 Correct 14 ms 3328 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Incorrect 14 ms 3328 KB Output isn't correct
16 Halted 0 ms 0 KB -