# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
150357 |
2019-09-01T08:12:44 Z |
먀(#3635, khsoo01) |
HicCup (FXCUP4_hiccup) |
C++17 |
|
88 ms |
4480 KB |
#include "hiccup.h"
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
bool can (int L) {
vector<int> S;
S.push_back(-1);
for(int i=0;i<n;i++) {
if(s[i] == 'H') S.push_back(-1);
if(s[i] == 'C') {
if(S.empty() || S.back() >= 0) return false;
S.pop_back();
S.push_back(1);
}
if(s[i] == '!') {
if(S.empty() || (-2 < S.back() && S.back() < 0)) return false;
if(S.back() > 0) S.back()++;
}
if(S.back() == L+1) {
S.pop_back();
if(S.empty()) return false;
if(S.back() < 0) S.back() = -2;
}
}
return S.size() == 1 && S[0] < 0;
}
int HicCup(string _) {
n = _.size();
s = _;
int S = -1, E = n;
while(S<E) {
int M = (S+E)>>1;
can(M+1) ? S = M+1 : E = M;
}
return S;
}
# |
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 |
28 ms |
4224 KB |
Output is correct |
6 |
Correct |
14 ms |
4096 KB |
Output is correct |
7 |
Correct |
14 ms |
4224 KB |
Output is correct |
8 |
Correct |
28 ms |
4352 KB |
Output is correct |
9 |
Correct |
27 ms |
4352 KB |
Output is correct |
10 |
Correct |
14 ms |
4224 KB |
Output is correct |
11 |
Correct |
6 ms |
432 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 |
28 ms |
4224 KB |
Output is correct |
6 |
Correct |
14 ms |
4096 KB |
Output is correct |
7 |
Correct |
14 ms |
4224 KB |
Output is correct |
8 |
Correct |
28 ms |
4352 KB |
Output is correct |
9 |
Correct |
27 ms |
4352 KB |
Output is correct |
10 |
Correct |
14 ms |
4224 KB |
Output is correct |
11 |
Correct |
17 ms |
4272 KB |
Output is correct |
12 |
Correct |
19 ms |
4352 KB |
Output is correct |
13 |
Correct |
19 ms |
4352 KB |
Output is correct |
14 |
Correct |
5 ms |
432 KB |
Output is correct |
15 |
Correct |
14 ms |
4304 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
640 KB |
Output is correct |
19 |
Correct |
36 ms |
4272 KB |
Output is correct |
20 |
Correct |
26 ms |
4352 KB |
Output is correct |
21 |
Correct |
64 ms |
4352 KB |
Output is correct |
22 |
Correct |
57 ms |
4096 KB |
Output is correct |
23 |
Correct |
86 ms |
4352 KB |
Output is correct |
24 |
Correct |
18 ms |
4352 KB |
Output is correct |
25 |
Correct |
26 ms |
4352 KB |
Output is correct |
26 |
Correct |
18 ms |
4480 KB |
Output is correct |
27 |
Correct |
68 ms |
4352 KB |
Output is correct |
28 |
Correct |
83 ms |
4224 KB |
Output is correct |
29 |
Correct |
88 ms |
4480 KB |
Output is correct |
30 |
Correct |
5 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
11 ms |
744 KB |
Output is correct |
33 |
Correct |
6 ms |
432 KB |
Output is correct |