# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1071099 | manhlinh1501 | Building 4 (JOI20_building4) | C++17 | 1859 ms | 372544 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 i64 = long long;
using pii = pair<int, int>;
const int MAXN = 4e3 + 5;
#define prev ___prev
int N;
int a[MAXN];
int b[MAXN];
bool dp[MAXN][MAXN][2];
array<int, 3> prev[MAXN][MAXN][2];
int ans[MAXN];
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N;
for(int i = 1; i <= 2 * N; i++) cin >> a[i];
for(int i = 1; i <= 2 * N; i++) cin >> b[i];
dp[0][0][0] = dp[0][0][1] = true;
for(int i = 1; i <= 2 * N; i++) {
if(a[i - 1] <= a[i]) {
for(int j = 0; j <= N; j++) {
if(dp[i - 1][j][0]) {
dp[i][j][0] = true;
prev[i][j][0] = {i - 1, j, 0};
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |