# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
151156 |
2019-09-01T22:14:54 Z |
kuroni |
HicCup (FXCUP4_hiccup) |
C++17 |
|
63 ms |
4288 KB |
#include "hiccup.h"
#include <bits/stdc++.h>
using namespace std;
bool check(string s, int k)
{
vector<pair<bool, int>> ve;
bool chk = false;
for (char &c : s)
if (c == 'H')
{
ve.push_back({false, 0});
chk = false;
}
else if (c == 'C')
{
if (ve.empty() || ve.back().first)
return false;
ve.back().first = true;
if (k == 0)
{
chk = true;
ve.pop_back();
}
}
else
{
if (!ve.empty())
{
if (!ve.back().first && !chk)
return false;
if (ve.back().first && (++ve.back().second == k))
{
chk = true;
ve.pop_back();
}
}
else if (!chk)
return false;
}
return ve.empty();
}
int HicCup(string s)
{
int le = 0, ri = s.size();
while (le <= ri)
{
int mi = (le + ri) / 2;
if (check(s, mi))
le = mi + 1;
else
ri = mi - 1;
}
return le - 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
18 ms |
4260 KB |
Output is correct |
6 |
Correct |
11 ms |
4260 KB |
Output is correct |
7 |
Correct |
11 ms |
4268 KB |
Output is correct |
8 |
Correct |
18 ms |
4212 KB |
Output is correct |
9 |
Correct |
18 ms |
4256 KB |
Output is correct |
10 |
Correct |
12 ms |
4256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
18 ms |
4260 KB |
Output is correct |
6 |
Correct |
11 ms |
4260 KB |
Output is correct |
7 |
Correct |
11 ms |
4268 KB |
Output is correct |
8 |
Correct |
18 ms |
4212 KB |
Output is correct |
9 |
Correct |
18 ms |
4256 KB |
Output is correct |
10 |
Correct |
12 ms |
4256 KB |
Output is correct |
11 |
Correct |
13 ms |
4276 KB |
Output is correct |
12 |
Correct |
14 ms |
4260 KB |
Output is correct |
13 |
Correct |
15 ms |
4228 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
12 ms |
4256 KB |
Output is correct |
16 |
Correct |
2 ms |
252 KB |
Output is correct |
17 |
Correct |
2 ms |
256 KB |
Output is correct |
18 |
Correct |
3 ms |
632 KB |
Output is correct |
19 |
Correct |
27 ms |
4256 KB |
Output is correct |
20 |
Correct |
18 ms |
4256 KB |
Output is correct |
21 |
Correct |
40 ms |
4256 KB |
Output is correct |
22 |
Correct |
44 ms |
4088 KB |
Output is correct |
23 |
Correct |
63 ms |
4284 KB |
Output is correct |
24 |
Correct |
17 ms |
4264 KB |
Output is correct |
25 |
Correct |
19 ms |
4260 KB |
Output is correct |
26 |
Correct |
19 ms |
4256 KB |
Output is correct |
27 |
Correct |
48 ms |
4260 KB |
Output is correct |
28 |
Correct |
63 ms |
4288 KB |
Output is correct |
29 |
Correct |
62 ms |
4260 KB |
Output is correct |
30 |
Correct |
2 ms |
256 KB |
Output is correct |
31 |
Correct |
2 ms |
256 KB |
Output is correct |
32 |
Correct |
5 ms |
632 KB |
Output is correct |
33 |
Correct |
2 ms |
256 KB |
Output is correct |