Submission #148612

# Submission time Handle Problem Language Result Execution time Memory
148612 2019-09-01T04:46:22 Z 요까할 로뭘 은명팀(#3558, mario05092929, foja001, earthk) HicCup (FXCUP4_hiccup) C++17
24 / 100
21 ms 3456 KB
#include "hiccup.h"
#include <bits/stdc++.h>
using namespace std;
stack <int> st;
int sum[1000005];

int HicCup(std::string S) { /// HicHup
	int n = S.size();
	int ans = 0,sum = 0,s2 = 0,minn = 10000000,ch = 0;
	reverse(S.begin(),S.end());
	for(char x : S)
    {
        if(x == 'C')
        {
            sum++;
            minn = min(minn,s2/sum);
            st.push(1);
        }
        else if(x == 'H')
        {
            if(st.empty()) return -1;
            st.pop();
        }
        else s2++;
    }
    //cout << st.empty() << " " << sum << " " << s2 << " " << minn << '\n';
    if(!st.empty()) return -1;
	else return minn;
}

Compilation message

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:8:6: warning: unused variable 'n' [-Wunused-variable]
  int n = S.size();
      ^
hiccup.cpp:9:6: warning: unused variable 'ans' [-Wunused-variable]
  int ans = 0,sum = 0,s2 = 0,minn = 10000000,ch = 0;
      ^~~
hiccup.cpp:9:45: warning: unused variable 'ch' [-Wunused-variable]
  int ans = 0,sum = 0,s2 = 0,minn = 10000000,ch = 0;
                                             ^~
# 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 5 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 21 ms 3328 KB Output is correct
6 Correct 15 ms 3328 KB Output is correct
7 Correct 14 ms 3200 KB Output is correct
8 Correct 21 ms 3456 KB Output is correct
9 Correct 21 ms 3376 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Correct 5 ms 384 KB Output is 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 5 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
5 Correct 21 ms 3328 KB Output is correct
6 Correct 15 ms 3328 KB Output is correct
7 Correct 14 ms 3200 KB Output is correct
8 Correct 21 ms 3456 KB Output is correct
9 Correct 21 ms 3376 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Correct 15 ms 3200 KB Output is correct
12 Correct 16 ms 3328 KB Output is correct
13 Correct 16 ms 3328 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Incorrect 14 ms 3328 KB Output isn't correct
16 Halted 0 ms 0 KB -