# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148954 | 2019-09-01T05:27:35 Z | 서울대학교 연구공원 944동 삼성전자서울대연구소(#3600, ho94949, dotorya, zigui) | HicCup (FXCUP4_hiccup) | C++17 | 6 ms | 512 KB |
#include "hiccup.h" #include<algorithm> #include<vector> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; bool check(ll m, std::string S) { vector<ll> L; L.push_back(0); int flag = 1; for(char c : S){ if(c == 'H'){ L.emplace_back(0); flag = true; } if(c == 'C'){ if(L.back() > 0) return false; L.pop_back(); L.back() += m; flag = false; } if(c == '!'){ if(flag) return false; L.back() -= 1; } } if(L.back() > 0) return false; return true; } int HicCup(std::string S) { ll s = 0, e = S.size(), m; while(s <= e){ ll m = (s+e) / 2; if(check(m, S)) s = m+1; else e = m-1; }swap(s, e); return s == S.size()? -1 : s; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Runtime error | 6 ms | 512 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 | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |