# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148554 | TLEWA맞 (#200) | HicCup (FXCUP4_hiccup) | C++17 | 23 ms | 3328 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<algorithm>
int HicCup(std::string S) {
int H=0,C=0,A=0;
int cnt;
int N=S.size();
int flag=0;
for(int i=0;i<N;i++){
if(!flag&&S[i]=='H')flag=1;
if(S[i]=='H'&&i<N-1&&S[i+1]=='!'){
return -1;
}
if(S[i]=='H')H++;
if(!flag&&S[i]=='C'){
return -1;
}
if(S[i]=='C'){
C++;
if(C>H)return -1;
cnt=0;
}
if(!flag&&S[i]=='!'){
return -1;
}
if(flag&&S[i]=='!'){
A++;
cnt++;
}
}
if(H!=C)return -1;
return std::min(A/H,cnt);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |