# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099579 | vladilius | Building 4 (JOI20_building4) | C++17 | 556 ms | 524288 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;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n; cin>>n;
int m = 2 * n;
vector<int> a(m + 1), b(m + 1);
for (int i = 1; i <= m; i++) cin>>a[i];
for (int i = 1; i <= m; i++) cin>>b[i];
const int N = 2e3 + 1;
bitset<N> bt[m + 1][2];
bt[1][0].set(1, 1);
bt[1][1].set(0, 1);
for (int i = 2; i <= m; i++){
if (a[i - 1] <= a[i]) bt[i][0] |= (bt[i - 1][0] << 1);
if (b[i - 1] <= a[i]) bt[i][0] |= (bt[i - 1][1] << 1);
if (a[i - 1] <= b[i]) bt[i][1] |= bt[i - 1][0];
if (b[i - 1] <= b[i]) bt[i][1] |= bt[i - 1][1];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |