#include "mosaic.h"
#define pb push_back
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int a[maxn][maxn], pref[maxn][maxn];
int n;
std::vector<long long> mosaic(std::vector<int> X, std::vector<int> Y,
std::vector<int> T, std::vector<int> B,
std::vector<int> L, std::vector<int> R)
{
int q = (int)T.size();
std::vector<long long> C(q, 0);
n = X.size();
for (int i = 1; i <= n; ++ i)
a[1][i] = X[i-1];
for (int i = 1; i <= n; ++ i)
a[i][1] = Y[i-1];
for (int i = 2; i <= 4; ++ i)
{
for (int j = i; j <= n; ++ j)
{
if(!a[i-1][j] && !a[i][j-1])a[i][j] = 1;
else a[i][j] = 0;
}
for (int j = i; j <= n; ++ j)
{
if(!a[j-1][i] && !a[j][i-1])a[j][i] = 1;
else a[j][i] = 0;
}
}
q = (int)T.size();
//std::vector<long long> C(q, 0);
vector < long long > res;
for (int i = 0; i < q; ++ i)
{
int row = T[i] + 1;
int col = L[i] + 1;
if(row <= col)
{
if(row <= 4)
{
res.pb(a[row][col]);
}
else
{
int base = col - (row - 4);
res.pb(a[4][base]);
}
}
else
{
if(col <= 4)
{
res.pb(a[row][col]);
}
else
{
int base = row - (col - 4);
res.pb(a[base][4]);
}
}
// int r = R[i] + 1;
//long long ans = pref[b][r] - pref[t-1][r] - pref[b][l-1] + pref[t-1][l-1];
//C[i] = ans;
}
return res;
}
/**
4
1 0 1 0
1 1 0 1
2
0 3 0 3
2 3 0 2
*/
# | 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... |