Submission #501938

#TimeUsernameProblemLanguageResultExecution timeMemory
501938aryan12Vision Program (IOI19_vision)C++17
100 / 100
11 ms3664 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; void construct_network(int H, int W, int K) { vector<int> left[H * W], right[H * W]; for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { left[i + j].push_back(i * W + j); right[W - 1 - j + i].push_back(i * W + j); //cout << "i = " << i << ", j = " << j << ", i + j = " << i + j << "\n"; //cout << "i = " << i << ", j = " << j << ", W - 1 - j + i = " << W - 1 - j + i << "\n"; } } vector<int> left_diag, pref_left_diag; vector<int> right_diag, pref_right_diag; for(int i = 0; i < H + W - 1; i++) { left_diag.push_back(add_or(left[i])); right_diag.push_back(add_or(right[i])); if(i == 0) { pref_left_diag.push_back(left_diag[0]); pref_right_diag.push_back(right_diag[0]); } else { pref_left_diag.push_back(add_or({pref_left_diag[i - 1], left_diag[i]})); pref_right_diag.push_back(add_or({pref_right_diag[i - 1], right_diag[i]})); } } vector<int> ans_left, ans_right, ans1_left, ans1_right; for(int i = K; i < H + W - 1; i++) { ans_left.push_back(add_and({pref_left_diag[i - K], left_diag[i]})); ans_left.push_back(add_and({pref_right_diag[i - K], right_diag[i]})); if(i != K) { ans1_left.push_back(add_and({pref_left_diag[i - K - 1], left_diag[i]})); ans1_left.push_back(add_and({pref_right_diag[i - K - 1], right_diag[i]})); } } int res1 = add_or(ans_left); if(K != H + W - 2) { int res2 = add_or(ans1_left); add_xor({res1, res2}); } /*std::vector<int> Ns; 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...