제출 #163324

#제출 시각아이디문제언어결과실행 시간메모리
163324farmerboyVision Program (IOI19_vision)C++14
12 / 100
22 ms2036 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; vector<int> checkBlock(vector<int> &a, vector<int> &b, int K) { vector<int> res; for (int i = K-1; i < int(a.size()); i++) { vector<int> g, h; for (int j = i - K + 1; j <= i; j++) { h.emplace_back(b[j]); g.emplace_back(a[j]); } res.emplace_back(add_and({ add_or(g), add_or({ add_or(h), add_and({ add_not(add_or(h)), add_not(add_xor(g)) }) }) })); } return res; } void construct_network(int H, int W, int K) { vector<int> lefDi1, rigDi1; vector<int> lefDi2, rigDi2; // step 1 + 2: right diagonal for (int i = H-1; i >= 0; i--) { vector<int> a; for (int x = i, y = 0; x < H && y < W; x++, y++) a.emplace_back(x * W + y); int g = add_xor(a); rigDi1.emplace_back(g); rigDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) ); } for (int i = 1; i < W; i++) { vector<int> a; for (int x = 0, y = i; x < H && y < W; x++, y++) a.emplace_back(x * W + y); int g = add_xor(a); rigDi1.emplace_back(g); rigDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) ); } // step 1 + 2: left diagonal for (int i = 0; i < W; i++) { vector<int> a; for (int x = 0, y = i; x < H && y >= 0; x++, y--) a.emplace_back(x * W + y); int g = add_xor(a); lefDi1.emplace_back(g); lefDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) ); } for (int i = 1; i < H; i++) { vector<int> a; for (int x = i, y = W-1; x < H && y >= 0; x++, y--) a.emplace_back(x * W + y); int g = add_xor(a); lefDi1.emplace_back(g); lefDi2.emplace_back( add_and( {add_not(g), add_or(a)} ) ); } // step 3-4-5: int g = add_and({ add_or(checkBlock(lefDi1, lefDi2, K+1)), add_or(checkBlock(rigDi1, rigDi2, K+1)) }); // step 6: int h = add_and({ add_or(checkBlock(lefDi1, lefDi2, K)), add_or(checkBlock(rigDi1, rigDi2, K)) }); // step 7: add_and({ g, add_not(h) }); }
#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...