# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1093924 | coldbr3w | Building 4 (JOI20_building4) | C++17 | 216 ms | 69232 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 pll pair<long long, long long>
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
const ll N = 1e6 + 100;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll block = 350;
ll n;
ll a[N][2];
pll dp[N][2];
void to_thic_cau(){
cin >> n;
for(int i = 1; i <= 2 * n;i++) cin >> a[i][0];
for(int i = 1; i <= 2 * n;i++) cin >> a[i][1];
dp[0][0] = dp[0][1] = {0, 0};
for(int i = 1; i <= 2 * n;i++){
dp[i][0] = dp[i][1] = {-1, -1};
for(int j = 0; j <= 1;j++){
if(dp[i-1][j].F != -1){
for(int k = 0; k <= 1;k++){
if(a[i-1][j] <= a[i][k]){
pll cur = dp[i-1][j];
cur.F += k, cur.S += k;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |