#include "hiccup.h"
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
#define mp make_pair
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
bool mycheck(vector<ll> Vu, int mi) {
reverse(all(Vu));
ll cur = 0;
for (auto it : Vu) {
cur -= mi;
cur += it;
if (cur < 0) return false;
}
return true;
}
int HicCup(std::string S) {
int N = S.size(), i, j;
int c = 0;
for (int i = 0; i < N; i++) {
if (S[i] == 'H') c++;
if (S[i] == 'C') c--;
if (c < 0) return -1;
}
if (c != 0) return -1;
int p = N;
for (int i = N - 1; i >= 0; i--) if (S[i] == 'C') p = i;
for (int i = 0; i < p; i++) if (S[i] == '!') return -1;
for (int i = 0; i + 1 < N; i++) if (S[i] == 'H' && S[i + 1] == '!') return -1;
int st = 0, en = INF, mi, rv = -1;
while (st <= en) {
mi = (st + en) / 2;
vector <vector<ll>> Vr;
vector <ll> Vu;
Vr.push_back(Vu);
int i;
for (i = 0; i < N; i++) {
if (S[i] == 'H') {
Vu.clear();
Vr.push_back(Vu);
}
else if (S[i] == 'C') {
if (!mycheck(Vr.back(), mi)) break;
Vr.pop_back();
Vr.back().push_back(0);
}
else Vr.back().back()++;
}
if (i >= N && mycheck(Vr.back(), mi)) {
rv = mi;
st = mi + 1;
}
else en = mi - 1;
}
return rv;
}
Compilation message
island.cpp:1:10: fatal error: hiccup.h: No such file or directory
#include "hiccup.h"
^~~~~~~~~~
compilation terminated.