Submission #1305146

#TimeUsernameProblemLanguageResultExecution timeMemory
1305146kawhietMosaic (IOI24_mosaic)C++20
7 / 100
74 ms12600 KiB
#include <bits/stdc++.h>
#include "mosaic.h"
using namespace std;

// bool first = 1;
// vector<vector<int>> a;
// vector<vector<long long>> p;

// long long get(int x1, int y1, int x2, int y2) {
//   x1++; y1++; x2++; y2++;
//   return p[x2][y2] - p[x2][y1 - 1] - p[x1 - 1][y2] + p[x1 - 1][y1 - 1];
// }
  
vector<long long> mosaic(vector<int> x, vector<int> y, vector<int> t, vector<int> b, vector<int> l, vector<int> r) {
  int n = x.size(), q = t.size();
  // if (first) {
  //   a.assign(n, vector<int>(n, -1));
  //   p.assign(n + 1, vector<long long>(n + 1, 0));
  //   a[0] = x;
  //   for (int i = 1; i < n; i++) {
  //     a[i][0] = y[i];
  //   }
  //   for (int i = 1; i < n; i++) {
  //     for (int j = 1; j < n; j++) {
  //       if ((a[i - 1][j] | a[i][j - 1]) == 0) {
  //         a[i][j] = 1;
  //       } else {
  //         a[i][j] = 0;
  //       }
  //     }
  //   }
  //   for (int i = 0; i < n; i++) {
  //     for (int j = 0; j < n; j++) {
  //       p[i + 1][j + 1] = p[i + 1][j] + p[i][j + 1] - p[i][j] + a[i][j];
  //     }
  //   }
  //   first = 0;
  // }
  vector<int> p(n + 1);
  for (int i = 0; i < n; i++) {
    p[i + 1] = p[i] + x[i];
  }
  vector<long long> ret;
  for (int i = 0; i < q; i++) {
    ret.push_back(p[r[i] + 1] - p[l[i]]);
    // ret.push_back(get(t[i], l[i], b[i], r[i]));
  }
  return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...