# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148914 | Powered By Zigui (#200) | HicCup (FXCUP4_hiccup) | C++17 | 208 ms | 12180 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 <string.h>
int t[1000003];
int cur[1000003];
int len;
int doable(std::string S, int x)
{
int n = S.length();
int cur_len = 0;
memset(t, 0, sizeof(t));
memset(cur, 0, sizeof(cur));
len = 0;
int erasing = 0;
for(int i=0;i<n;i++)
{
t[len] = S[i];
cur[len] = (S[i] == '!' ? (len ? cur[len-1]+1 : 1) : 0);
len++;
if(erasing && len >= 2 && t[len-2] == 'H' && t[len-1] == '!') len--;
else if(cur[len-1] >= x && len >= x+2 && t[len-x-2] == 'H' && t[len-x-1] == 'C')
{
len -= x+2;
erasing = 1;
}
else erasing = 0;
}
for(int i=0;i<len;i++)
{
if(t[i] != '!') return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |