# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
148457 |
2019-09-01T04:27:20 Z |
rkm0959(#3623, jun6873, babo) |
HicCup (FXCUP4_hiccup) |
C++17 |
|
183 ms |
8400 KB |
#include "hiccup.h"
#include <bits/stdc++.h>
using namespace std;
string s;
bool possible(int k) {
vector<int> v;
int H = 0, C = 1;
for (char i : s) {
if (i == 'H') H++, C = 1;
if (i == 'C') {
if (!H or !C) return false;
H--;
if (k) v.push_back(k);
}
if (i == '!') {
C = 0;
if (!v.empty() and !--v.back()) v.pop_back(), C = 1;
}
}
return !H and v.empty();
}
int HicCup(std::string S) {
s = S;
int l = -1, r = 1000004;
while (l+1<r) {
int m = (l+r)/2;
if (possible(m)) l = m;
else r = m;
}
return l;
}
# |
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 |
11 ms |
808 KB |
Output is correct |
5 |
Correct |
177 ms |
8400 KB |
Output is correct |
6 |
Correct |
14 ms |
4224 KB |
Output is correct |
7 |
Correct |
14 ms |
4352 KB |
Output is correct |
8 |
Correct |
174 ms |
8212 KB |
Output is correct |
9 |
Correct |
183 ms |
8396 KB |
Output is correct |
10 |
Correct |
14 ms |
4352 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 |
11 ms |
808 KB |
Output is correct |
5 |
Correct |
177 ms |
8400 KB |
Output is correct |
6 |
Correct |
14 ms |
4224 KB |
Output is correct |
7 |
Correct |
14 ms |
4352 KB |
Output is correct |
8 |
Correct |
174 ms |
8212 KB |
Output is correct |
9 |
Correct |
183 ms |
8396 KB |
Output is correct |
10 |
Correct |
14 ms |
4352 KB |
Output is correct |
11 |
Correct |
15 ms |
4224 KB |
Output is correct |
12 |
Correct |
13 ms |
4352 KB |
Output is correct |
13 |
Correct |
18 ms |
4352 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
15 ms |
4352 KB |
Output is correct |
16 |
Incorrect |
5 ms |
256 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |