#include <bits/stdc++.h>
#include "mosaic.h"
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
const int mxn = 2e5 + 100;
ll X[3][mxn], Y[mxn][3];
// x - vertical, y - horizontal
ll get(int x, int y) {
if (x <= 2) return X[x][y];
if (y <= 2) return Y[x][y];
if (x < y) return X[2][y - (x - 2)];
return Y[x - (y - 2)][2];
}
vector<ll> mosaic(vector<int> _X, vector<int> _Y, vector<int> T, vector<int> B, vector<int> L, vector<int> R) {
int n = _X.size();
int q = T.size();
vector<ll> C(q, 0);
for (int i = 0; i < n; i++) X[0][i] = _X[i], Y[i][0] = _Y[i];
for (int i = 1; i < 3; i++) {
X[i][0] = Y[i][0];
for (int j = 1; j < n; j++) {
X[i][j] = (!X[i][j - 1] && !X[i - 1][j]);
}
}
for (int i = 1; i < 3; i++) {
Y[0][i] = X[0][i];
for (int j = 1; j < n; j++) {
Y[j][i] = (!Y[j][i - 1] && !Y[j - 1][i]);
}
}
for (int i = 0; i < q; i++) {
C[i] = get(T[i], L[i]);
}
return C;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |