Submission #149817

# Submission time Handle Problem Language Result Execution time Memory
149817 2019-09-01T07:12:54 Z (대충 적당한 팀명)(#3621, rose0310, cos18, baikdohyup) HicCup (FXCUP4_hiccup) C++17
0 / 100
5 ms 384 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') {
				std::cout << S[i] << ',' << "here";
				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 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -