Submission #148394

# Submission time Handle Problem Language Result Execution time Memory
148394 2019-09-01T04:17:01 Z Welcome to osu!(#3734, easrui, CodePlatina, jhwest2) HicCup (FXCUP4_hiccup) C++17
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>
#include "hiccup.h"
using namespace std;

int HicCup(std::string S)
{
    int cnt = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i]=='H') cnt++;
        else cnt--;
        if(cnt<0){
            cout << -1;
            return 0;
        }
    }
    if(cnt!=0) cout << -1;
    else cout << 0;
}

Compilation message

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:8:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<S.size(); i++){
                  ~^~~~~~~~~
hiccup.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -