Submission #148507

# Submission time Handle Problem Language Result Execution time Memory
148507 2019-09-01T04:34:13 Z TLEWA맞(#3625, H_Squad, sungjune222, str0ct) HicCup (FXCUP4_hiccup) C++17
0 / 100
21 ms 3456 KB
#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++;
            cnt=0;
        }
        if(flag&&S[i]=='!'){
            A++;
            cnt++;
        }
    }
    if(H!=C)return -1;
    return std::min(A/H,cnt);
}

Compilation message

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:5:9: warning: 'cnt' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int cnt;
         ^~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 19 ms 3328 KB Output is correct
6 Correct 13 ms 3328 KB Output is correct
7 Correct 14 ms 3328 KB Output is correct
8 Correct 20 ms 3328 KB Output is correct
9 Correct 21 ms 3456 KB Output is correct
10 Incorrect 19 ms 3328 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 19 ms 3328 KB Output is correct
6 Correct 13 ms 3328 KB Output is correct
7 Correct 14 ms 3328 KB Output is correct
8 Correct 20 ms 3328 KB Output is correct
9 Correct 21 ms 3456 KB Output is correct
10 Incorrect 19 ms 3328 KB Output isn't correct