# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
150864 | Welcome to osu! (#200) | HicCup (FXCUP4_hiccup) | C++17 | 6 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "hiccup.h"
#include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int HicCup(std::string S) {
int N = S.size();
int lo=0, hi=N;
stack<pii> st;
while (lo<hi) {
while (!st.empty()) st.pop();
int mid = lo+hi+1>>1;
bool flag = true;
for (int i=0; i<N; i++) {
if (S[i] == 'H') st.push(pii('H', 0));
else if (S[i] == 'C') {
if (st.top().va != 'H') {
flag = false;
break;
}
st.pop();
st.push(pii('C', 1));
}
else if (S[i] == '!') {
if (st.top().va != 'C') {
flag = false;
break;
}
pii tmp = st.top();
st.pop();
st.push(pii('C', tmp.vb+1));
if (tmp.vb+1 == mid) st.pop();
}
}
if (!st.empty()) flag = false;
if (flag) lo = mid;
else hi = mid-1;
}
return lo;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |