Submission #150716

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

int HicCup(string s) { /// HicHup
	int n = s.size();
	stack <int> l;
	vector <int> hc;
	for(int i = 0;i < n;i++) if(s[i] == '!') l.push(i);
	for(int i = 0;i < n;i++)
    {
        if(s[i] == '!') continue;
        if(s[i] == 'H') st.push(1);
        else
        {
            if(st.empty()) return -1;
            hc.push_back(i);
            st.pop();
        }
    }
    if(!st.empty()) return -1;
    int cnt = 0,sum = 0,ans = 10000000,mi = 10000000;
    for(int i = hc.size()-1;i >= 0;i--)
    {
        cnt = 0;
        //cout << hc[i] << " ";
        while(!l.empty()&&l.top() > hc[i]) l.pop(),cnt++;
        sum += cnt;
        //cout << cnt << " ";
        mi = min(mi,sum/((int)hc.size()-i));
        ans = min(ans,mi);
        //cout << ans << " ";
    }
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 7 ms 768 KB Output is correct
5 Correct 26 ms 5484 KB Output is correct
6 Correct 15 ms 3328 KB Output is correct
7 Correct 15 ms 3328 KB Output is correct
8 Correct 25 ms 5540 KB Output is correct
9 Correct 29 ms 5484 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 7 ms 768 KB Output is correct
5 Correct 26 ms 5484 KB Output is correct
6 Correct 15 ms 3328 KB Output is correct
7 Correct 15 ms 3328 KB Output is correct
8 Correct 25 ms 5540 KB Output is correct
9 Correct 29 ms 5484 KB Output is correct
10 Correct 13 ms 3328 KB Output is correct
11 Correct 24 ms 4860 KB Output is correct
12 Correct 24 ms 7040 KB Output is correct
13 Correct 18 ms 7424 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Incorrect 26 ms 7424 KB Output isn't correct
16 Halted 0 ms 0 KB -