# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
148461 | | お前はもう死んでいる (#200) | HicCup (FXCUP4_hiccup) | C++17 | | 23 ms | 7168 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "hiccup.h"
#include <vector>
int HicCup(std::string S) {
int n = S.size();
std::vector<int> freq(n + 1, 0);
int ans = 0;
int bal = 0;
for(auto c : S) {
if(c == '!') {
if(freq[ans] == 0) {
return -1;
} else {
freq[ans]--;
freq[ans+1]++;
if(freq[ans] == 0) {
ans++;
}
}
} else if(c == 'H') {
bal++;
} else {
if(bal == 0) {
return -1;
}
bal--;
ans = 0;
freq[0]++;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |