Submission #149123

#TimeUsernameProblemLanguageResultExecution timeMemory
149123팀명못정해서15시간째고민중인팀 (#200)HicCup (FXCUP4_hiccup)C++17
24 / 100
22 ms3328 KiB
#include "hiccup.h" #include<bits/stdc++.h> using namespace std; int HicCup(std::string S) { int N = S.size(); stack<int> st; bool chk=true,r=false; for(auto i:S){ if(i=='H') st.push(1); else if(i=='C'){ if(!st.empty()&&st.top()) st.pop(),r=true; else chk=false; } else if(!r) chk=false; } if(!st.empty()) chk=false; return chk?0:-1; }

Compilation message (stderr)

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:6:6: warning: unused variable 'N' [-Wunused-variable]
  int N = S.size();
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...