# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1008176 | vako_p | Building 4 (JOI20_building4) | C++14 | 187 ms | 68920 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;
#define ll long long
#define pb push_back
const int mxN = 1e6 + 5;
ll n,a[mxN],b[mxN];
pair<ll,ll> A[mxN],B[mxN];
char ans[mxN];
void rec(ll i, ll k, ll x){
if(i == 0) return;
// cout << i << ' ' << ((x == 0) ? a[i] : b[i]) << ' ' << a[i - 1] << ' ' << x << '\n';
if(k > 0 and A[i - 1].first <= k and A[i - 1].second >= k and a[i - 1] <= ((x == 0) ? a[i] : b[i])){
ans[i - 1] = 'A';
rec(i - 1, k - 1, 0);
}
else{
ans[i - 1] = 'B';
rec(i - 1, k, 1);
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 0; i < 2 * n; i++) cin >> a[i];
for(int i = 0; i < 2 * n; i++) cin >> b[i];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |