# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
316660 | 2020-10-27T05:36:34 Z | kylych03 | Vision Program (IOI19_vision) | C++14 | 0 ms | 0 KB |
#include "vision.h" #include <bits/stdc++.h> #include "grader.cpp" using namespace std; vector<int> dl[404], dr[404]; int diogl[404], diogr[404], prl[404], prr[404]; void construct_network(int H, int W, int K) { vector <int> vec1, vec2; for(int i = 0; i < H; i++) for(int j = 0 ; j < W ; j++){ dl[i+j].push_back( i*W + j); dr[i - j + W -1].push_back(i*W + j); } for(int i = 0 ; i < H + W -1; i++){ diogl[i] = add_or(dl[i]); diogr[i] = add_or(dr[i]); if(i==0){ prl[i] = add_or({diogl[i]}); prr[i] = add_or({diogr[i]}); } else{ prl[i] = add_or({prl[i-1], diogl[i]}); prr[i] = add_or({prr[i-1], diogr[i]}); } if(i>=K){ vec1.push_back( add_and({ diogl[i], prl[i - K]})); vec1.push_back( add_and({ diogr[i], prr[i - K]})); } if(i>=K+1){ vec2.push_back( add_and({ diogl[i], prl[i - K - 1]})); vec2.push_back( add_and({ diogr[i], prr[i - K - 1]})); } } if(vec2.size()!=0 ) add_xor( {add_or(vec1), add_or(vec2)}); else add_or(vec1); }