Submission #267199

#TimeUsernameProblemLanguageResultExecution timeMemory
267199ggoorooVision Program (IOI19_vision)C++14
0 / 100
2 ms1148 KiB
#include "vision.h" #include <cstdio> #include <iostream> #include <queue> #define N 205 using namespace std; int h, w, k, T, en, v[N][N]; int dr[4] = {-1, 0, 0, 1}, dc[4] = {0, -1, 1, 0}; queue<int> qr, qc, qe; int pq_num(int p, int q) { return p * w + q; } void pu(int p, int q, int e) { if (p < 0 || p >= h || q < 0 || q >= w || v[p][q] == T) return; v[p][q] = T; qr.push(p); qc.push(q); qe.push(e); } void f(int p, int q, int k) { int i, tr, tc, te, re; pu(p, q, 0); while (!qr.empty()) { tr = qr.front(); qr.pop(); tc = qc.front(); qc.pop(); te = qe.front(); qe.pop(); if (te == k) { re = add_and({pq_num(p, q), pq_num(tr, tc)}); if (re == 1) {en = 1; return;} } else { for (i = 0; i < 4; i++) { pu(tr + dr[i], tc + dc[i], te + 1); } } } } void construct_network(int hh, int ww, int kk) { int i, j; h = hh; w = ww; k = kk; std::vector<int> Ns; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { T++; f(i, j, k); if (en == 1) return; } } // Ns = {0, 1}; // int a = add_and(Ns); // Ns = {0, a}; // int b = add_or(Ns); // Ns = {0, 1, b}; // int c = add_xor(Ns); // add_not(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...