# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150864 | 2019-09-01T08:59:59 Z | Welcome to osu!(#3734, easrui, CodePlatina, jhwest2) | HicCup (FXCUP4_hiccup) | C++17 | 6 ms | 384 KB |
#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; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Runtime error | 6 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Runtime error | 6 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |