제출 #223755

#제출 시각아이디문제언어결과실행 시간메모리
223755rama_pangVision Program (IOI19_vision)C++14
100 / 100
74 ms7536 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; int IsExist(int H, int W, int K) { // Check whether there exists one of the values >= K vector<vector<int>> diagL(H + W - 1); // from topleft vector<vector<int>> diagR(H + W - 1); // from topright for (int x = 0; x < H; x++) { for (int y = 0; y < W; y++) { diagL[x + y].emplace_back(x * W + y); diagR[x + W - y - 1].emplace_back(x * W + y); } } vector<int> prefL; // diagonal prefix from topleft vector<int> prefR; // diagonal prefix from topright vector<int> check; // check for diagonal_distance >= K from either topleft or topright for (int d = K; d < H + W - 1; d++) { prefL.emplace_back(add_or(diagL[d - K])); prefR.emplace_back(add_or(diagR[d - K])); check.emplace_back(add_and({add_or(diagL[d]), add_or(prefL)})); check.emplace_back(add_and({add_or(diagR[d]), add_or(prefR)})); } return add_or(check); } void construct_network(int H, int W, int K) { if (K == H + W - 2) { IsExist(H, W, K); } else { add_and({IsExist(H, W, K), add_not(IsExist(H, W, K + 1))}); } }
#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...