제출 #1156318

#제출 시각아이디문제언어결과실행 시간메모리
1156318The_SamuraiMosaic (IOI24_mosaic)C++20
7 / 100
89 ms27328 KiB
#include "mosaic.h" #include "bits/stdc++.h" using namespace std; using ll = long long; 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(); vector pref(2, vector(n + 1, 0)); vector a(n, vector(min(n, 3), false)); a[0] = vector(n, false); for (int i = 0; i < n; i++) { a[0][i] = X[i]; a[i][0] = Y[i]; } for (int i = 1; i < n; i++) { if (i <= 2) a[i].resize(n); for (int j = 1; j < a[i].size(); j++) { a[i][j] = !(a[i - 1][j] | a[i][j - 1]); } } for (int i = 0; i < 1; i++) for (int j = 0; j < n; j++) { pref[i + 1][j + 1] = a[i][j] + pref[i + 1][j] + pref[i][j + 1] - pref[i][j]; } vector<ll> ans(T.size()); for (int i = 0; i < T.size(); i++) { auto [x1, x2] = make_pair(T[i], B[i]); auto [y1, y2] = make_pair(L[i], R[i]); x1++, x2++, y1++, y2++; int now = pref[x2][y2] - pref[x2][y1 - 1] - pref[x1 - 1][y2] + pref[x1 - 1][y1 - 1]; // for (int x = T[i]; x <= B[i]; x++) { // for (int y = L[i]; y <= R[i]; y++) { // if (min(x, y) <= 2) { // now += a[x][y]; // continue; // } // int d = min(x, y) - 2; // now += a[x - d][y - d]; // } // } ans[i] = now; } // for (int i = 0; i < n; i++) { // for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << ' '; // cout << endl; // } return ans; // for (int i = 2; i < n - 1; i++) { // for (int j = 2; j < n - 1; j++) { // if (a[i][j] != a[i - 1][j - 1]) { // cout << i << ' ' << j << endl; // } // // assert(a[i][j] == a[i - 1][j - 1]); // } // } // return vector(T.size(), 0ll); }
#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...