# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149064 | 2019-09-01T05:40:04 Z | Cafe Maru(#3599, bryan, pps789, kazel) | HicCup (FXCUP4_hiccup) | C++17 | 6 ms | 384 KB |
#include "hiccup.h" #include<bits/stdc++.h> using namespace std; int HicCup(std::string S) { int N = S.size(); int ans = 1111111; vector<int> es, cs; es.push_back(0); cs.push_back(0); for(int i=N-1;i>=0;i--) { if (S[i] == 'H') { int e = es.back(); int c = cs.back(); es.pop_back(); cs.pop_back(); if (es.empty()) return -1; if(e > 0 && c == 0) { return -1; } else if (e == 0 && c == 0) { continue; } else if (e == 0 & c > 0) { ans = 0; } else { int t = e/c; ans = min(ans, t); } } else if (S[i] == 'C') { cs.back()++; es.push_back(0); cs.push_back(0); } else { es.back()++; } } if (ans == 1111111) ans = -1; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |