# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
150922 | JustInCase | HicCup (FXCUP4_hiccup) | C++17 | 2 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#ifdef LOCAL
#include "grader.cpp"
#else
#include "hiccup.h"
#endif
#define hic_cup HicCup
bool check_is_x_string(const std::string &s, int32_t x) {
std::stack< int32_t > st;
for(int32_t i = 0; i < s.size(); i++) {
if(s[i] == 'H') {
st.push(x);
}
else if(s[i] == '!') {
if(!st.empty()) {
int32_t aux = st.top();
st.pop();
aux--;
if(aux != 0) {
st.push(aux);
}
}
}
}
if(st.empty()) {
return true;
}
else {
return false;
}
}
int32_t hic_cup(std::string s) {
int32_t low = 1, high = s.size();
while(low <= high) {
int32_t mid = (low + high) / 2;
if(check_is_x_string(s, mid)) {
low = mid + 1;
}
else {
high = mid - 1;
}
}
return low - 1;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |