Submission #1246952

#TimeUsernameProblemLanguageResultExecution timeMemory
1246952ErJMosaic (IOI24_mosaic)C++20
22 / 100
1039 ms2162688 KiB
#include "mosaic.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vi> #define pp pair<ll, ll> #define vp vector<pp> vi 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) { ll n = X.size(); vvi grid(n, vi(n, 0)); for(int i = 0; i < n; i++){ grid[i][0] = X[i]; grid[0][i] = Y[i]; } for(int i = 1; i < n; i++){ for(int j = 1; j < n; j++){ if(grid[i - 1][j] == 0 && grid[i][j - 1] == 0){ grid[i][j] = 1; } } } vvi pref(n + 1, vi(n + 1, 0)); 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] + grid[i][j]; } } ll q = (int)T.size(); vi C(q, 0); for(int i = 0; i < q; i++){ C[i] = pref[R[i] + 1][B[i] + 1] - pref[R[i] + 1][T[i]] - pref[L[i]][B[i] + 1] + pref[L[i]][T[i]]; } return C; }
#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...