# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1126425 | TAhmed33 | Building 4 (JOI20_building4) | C++20 | 1 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
typedef long long ll;
typedef long double ld;
const int MAXN = 1e6 + 25;
int n, a[MAXN][2], c[MAXN];
void solve () {
cin >> n; n *= 2;
for (int i = 1; i <= n; i++) {
cin >> a[i][0];
}
for (int i = 1; i <= n; i++) {
cin >> a[i][1];
}
int prv = 0;
for (int i = 1; i <= n; i++) {
if (a[i][0] >= prv && a[i][1] >= prv) {
if (a[i][0] <= a[i][1]) {
c[i] = 0;
prv = a[i][0];
} else {
c[i] = 1;
prv = a[i][1];
}
} else if (a[i][0] >= prv) {
c[i] = 0;
prv = a[i][0];
} else if (a[i][1] >= prv) {
c[i] = 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |