제출 #1124149

#제출 시각아이디문제언어결과실행 시간메모리
1124149Mousa_Aboubaker모자이크 (IOI24_mosaic)C++20
22 / 100
1161 ms1697248 KiB
#include "mosaic.h" #include <bits/stdc++.h> using namespace std; vector<long long> mosaic(vector<int> X, vector<int> Y, vector<int> T, vector<int> B, vector<int> L, vector<int> R) { vector<int> x = X, y = Y, t = T, b = B, l = L, r = R; int n = (int)x.size(), q = (int)t.size(); vector a(n, vector<int>(n)); for(int i = 0; i < n; i++) { a[0][i] = x[i]; a[i][0] = y[i]; } for(int i = 1; i < n; i++) for(int j = 1; j < n; j++) a[i][j] = a[i - 1][j] == 0 and a[i][j - 1] == 0; vector pref(n + 1, vector<int>(n + 1)); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { pref[i + 1][j + 1] = pref[i + 1][j] + pref[i][j + 1] - pref[i][j] + a[i][j]; } } vector<long long> res(q); for(int i = 0; i < q; i++) { int i1 = t[i], j1 = l[i]; int i2 = b[i], j2 = r[i]; res[i] = pref[i2 + 1][j2 + 1] - pref[i1][j2 + 1] - pref[i2 + 1][j1] + pref[i1][j1]; } return res; }
#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...