# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068984 | _8_8_ | Building 4 (JOI20_building4) | C++17 | 1 ms | 604 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;
const int N = 100 + 12, MOD = (int)1e9 + 7;
int n,a[N][2];
int dp[N][2][N];
int mx[N][2],mn[N][2];
bool in(int l,int r,int x) {
return (l <= x && x <= r);
}
void test() {
cin >> n;
for(int i = 1; i <= n + n; i++) {
cin >> a[i][1];
}
for(int i = 1; i <= n + n; i++) {
cin >> a[i][0];
}
for(int i = 1; i <= n + n; i++) {
for(int k = 0;k < 2;k++) {
mn[i][k] = 1e9;
mx[i][k] = -1e9;
for(int t = 0;t < 2;t++) {
if(a[i][k] >= a[i - 1][t]) {
mx[i][k] = max(mx[i - 1][t] + k,mx[i][k]);
mn[i][k] = min(mn[i][k],k + mn[i - 1][t]);
// cout << i << ' ' << k << ' ' << t << ' ' <<mx[i - 1][t] + k << ' ' << mn[i - 1][t] + k << '\n';
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |