#include "mosaic.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> a[200005];
vector<int> pref[200005];
int n;
int gumqaq(int x, int x1, int y, int y1)
{
  if(x > x1)
  {
    swap(x, x1);
    swap(y, y1);
  }
  if(y > y1)
  {
    swap(x, x1);
    swap(y, y1);
  }
  int arj = pref[x1][y1];
  if(x)arj -= pref[x - 1][y1];
  if(y)arj-=pref[x1][y - 1];
  if(x && y)arj += pref[x - 1][y - 1];
  return arj;
}
int gum(int x, int x1, int y, int y1)
{
  return 0;
  // int qaq = 0;
  // if(y <= 0)
  //   qaq += a[x][0];
  // if(y <= 1 && 1 <= y1)
  //   qaq += a[x][1];
  // y = max(y, 2);
  // if(y > y1)return qaq;
  // int han = min(x - 2, y - 2);
  // x -= han;
  // y -= han;
  // han = min(x1 - 2, y1 - 2);
  // x1 -= han;
  // y1 -= han;
  // if(x == x1 || y == y1)return gum(x, x1, y, y1) + qaq;
  // return gum(x, 2, y, 2) + gum(2, x1, 2, y1) - a[2][2] + qaq;
}
vector<long long> mosaic(vector<int> X, vector<int> Y,
                              vector<int> T, vector<int> B,
                              vector<int> L, vector<int> R) {
  n = X.size();
  int Q = (int)T.size();
  vector<long long> C(Q, 0);
  pref[0].push_back(X[0]);
  a[0].push_back(X[0]);
  for (int i = 1; i < X.size(); i++)
  {
    a[0].push_back(X[i]);
    pref[0].push_back(pref[0][i - 1] + a[0][i]);
  }
  for (int i = 1; i < Y.size(); i++)
  {
    a[i].push_back(Y[i]);
    pref[i].push_back(pref[i - 1][0] + a[i][0]);
  }
  int n = X.size();
  for (int i = 1; i < n; i++)
  {
    for (int j = 1; j < n; j++)
    {
      if(i <= 2 || j <= 2)
      {
        if(a[i - 1][j] == 0 && a[i][j - 1] == 0)
        {
          a[i].push_back(1);
        }
        else
        {
          a[i].push_back(0);
        }
        pref[i].push_back(pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + a[i][j]);
      }
      else
      break;
    }
  }
  for (int i = 0; i < Q; i++)
  {
    C[i] = gum(T[i], B[i], L[i], R[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... |