Submission #149217

# Submission time Handle Problem Language Result Execution time Memory
149217 2019-09-01T05:59:34 Z (παρα)γεμιστά(#3619, cfalas, ctziapo, Charis02) HicCup (FXCUP4_hiccup) C++17
24 / 100
1000 ms 3448 KB
#include "hiccup.h"
#include<bits/stdc++.h>
using namespace std;

char sec(stack<char> a){
	int t = a.top();
	a.pop();
	int b = a.top();
	a.push(t);
	return b;
}

int HicCup(std::string s) {
	stack<char> st;
	for(int i=0;i<s.size();i++){
		st.push(s[i]);
		while(st.size()>=2 && st.top()=='C' && sec(st)=='H') st.pop(), st.pop();
	}
	if(st.size()!=0) return -1;
	return 0;
}

Compilation message

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:15:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<s.size();i++){
              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 12 ms 512 KB Output is correct
5 Correct 171 ms 3392 KB Output is correct
6 Correct 712 ms 3352 KB Output is correct
7 Correct 977 ms 3328 KB Output is correct
8 Correct 163 ms 3328 KB Output is correct
9 Correct 252 ms 3328 KB Output is correct
10 Correct 628 ms 3328 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 12 ms 512 KB Output is correct
5 Correct 171 ms 3392 KB Output is correct
6 Correct 712 ms 3352 KB Output is correct
7 Correct 977 ms 3328 KB Output is correct
8 Correct 163 ms 3328 KB Output is correct
9 Correct 252 ms 3328 KB Output is correct
10 Correct 628 ms 3328 KB Output is correct
11 Execution timed out 1100 ms 3448 KB Time limit exceeded
12 Halted 0 ms 0 KB -