Submission #1246362

#TimeUsernameProblemLanguageResultExecution timeMemory
1246362CyberCowMosaic (IOI24_mosaic)C++20
8 / 100
74 ms11336 KiB
#include "mosaic.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int a[5][200005]; int pref[5][200005]; ll gum(ll x, ll x1, ll y, ll y1) { if(x1 == 0 || y1 == 0) return 0; if(!x)x++; if(!y)y++; if((x1 - x) % 2 || (y1 - y) % 2) { return (x1 - x + 1) * (y1 - y + 1) / 2; } if((x + y) % 2) return (x1 - x + 1) * (y1 - y + 1) / 2; return (x1 - x + 1) * (y1 - y + 1) / 2 + 1; } vector<long long> mosaic(vector<int> X, vector<int> Y, vector<int> T, vector<int> B, vector<int> L, vector<int> R) { int Q = (int)T.size(); vector<long long> C(Q, 0); // pref[0][0] = X[0]; // a[0][0] = X[0]; // for (int i = 1; i < X.size(); i++) // { // a[0][i] = X[i]; // pref[0][i] = pref[0][i - 1] + a[0][i]; // } // for (int i = 1; i < Y.size(); i++) // { // a[i][0] = Y[i]; // pref[i][0] = 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(a[i - 1][j] == 0 && a[i][j - 1] == 0) // { // a[i][j] = 1; // if(a[i - 1][j - 1] == 0 && i > 2 && j > 2) // { // throw; // } // } // pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + a[i][j]; // } // } for (int i = 0; i < Q; i++) { C[i] = gum(T[i], B[i], L[i], R[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...