# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
150052 | GucciBelt (#200) | HicCup (FXCUP4_hiccup) | C++17 | 217 ms | 5444 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "hiccup.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+5;
int HicCup(string S) {
stack<int> stk;
for(int i = 0; i < S.size(); i++) {
if(S[i] == 'H') stk.emplace(i);
else if(S[i] == 'C') {
if(stk.empty()) return -1;
else stk.pop();
}
}
if(!stk.empty()) return -1;
int l = 0, r = S.size();
while(l < r) {
int mid = (l + r + 1) >> 1;
queue<int> Q;
bool chk = false;
for(int i = 0; i < S.size(); i++) {
if(S[i] == 'C') {
chk = true;
Q.emplace(0);
} else if(S[i] == '!') {
if(Q.empty() && !chk) return -1;
else if(!Q.empty()) {
int now = Q.front(); Q.pop();
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |