Submission #622539

#TimeUsernameProblemLanguageResultExecution timeMemory
622539cheissmartVision Program (IOI19_vision)C++14
0 / 100
8 ms1108 KiB
#include "vision.h" #include <bits/stdc++.h> #define F first #define S second #define V vector #define MP make_pair #define EB emplace_back #define PB push_back #define SZ(v) int((v).size()) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; void construct_network(int H, int W, int K) { int n = H, m = W; auto id = [&] (int i, int j) { return i * W + j; }; // vi aux; // for(int i = 0; i < H; i++) { // for(int j = 0; j < W; j++) { // vi tt; // for(int ii = 0; ii < H; ii++) if(abs(ii - i) <= K) { // int dd = K - abs(ii - i); // for(int jj:{j + dd, j - dd}) if(jj >= 0 && jj < W) { // tt.PB(id(ii, jj)); // } // } // if(SZ(tt)) { // int OR = add_or(tt); // aux.PB(add_and({id(i, j), OR})); // } // } // } // add_or(aux); vi row(n), col(m); // xor for(int i = 0; i < n; i++) { vi tt; for(int j = 0; j < m; j++) tt.PB(id(i, j)); row[i] = add_xor(tt); } for(int j = 0; j < m; j++) { vi tt; for(int i = 0; i < n; i++) tt.PB(id(i, j)); col[j] = add_xor(tt); } vi prow(n), pcol(m); vi nprow(n), npcol(m); prow[0] = row[0]; for(int i = 1; i < n; i++) prow[i] = add_xor({prow[i - 1], row[i]}); for(int i = 0; i < n; i++) nprow[i] = add_not(row[i]); pcol[0] = col[0]; for(int i = 1; i < m; i++) pcol[i] = add_xor({pcol[i - 1], col[i]}); for(int i = 0; i < m; i++) npcol[i] = add_not(col[i]); int norow = add_and(nprow); int nocol = add_and(npcol); vi aux; for(int i = 0; i + 1 < n; i++) { vi todo; todo.PB(prow[i]); if(i) todo.PB(nprow[i - 1]); todo.PB(nprow[i + 1]); todo.PB(nocol); aux.PB(add_and(todo)); } for(int j = 0; j < m - 1; j++) { vi todo; todo.PB(pcol[j]); if(j) todo.PB(npcol[j - 1]); todo.PB(npcol[j + 1]); todo.PB(norow); aux.PB(add_and(todo)); } add_or(aux); }
#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...