# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988794 | _callmelucian | Building 4 (JOI20_building4) | C++14 | 520 ms | 77004 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tt;
#define all(a) a.begin(), a.end()
#define filter(a) a.erase(unique(all(a)), a.end())
const int mn = 1e6 + 6;
int a[2][mn], dpLow[2][mn], dpHigh[2][mn];
vector<char> ans;
bool ok (int cur, int i, int need) {
return dpLow[cur][i] <= need && need <= dpHigh[cur][i];
}
void trace (int cur, int i, int need) {
if (i == 1) return ans.push_back(cur + 'A'), void();
for (int pre = 0; pre < 2; pre++) {
if (a[pre][i - 1] <= a[cur][i] && ok(pre, i - 1, need - cur)) {
trace(pre, i - 1, need - cur);
return ans.push_back(cur + 'A'), void();
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |