# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
151152 |
2019-09-01T22:09:23 Z |
kuroni |
HicCup (FXCUP4_hiccup) |
C++17 |
|
2 ms |
256 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)
{
cout << c;
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;
}
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 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |