# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646782 | 2022-09-30T15:44:11 Z | ALI | Vision Program (IOI19_vision) | C++14 | 0 ms | 0 KB |
#include "vision.h" #include <bits/stdc++.h> #define pb push_back using namespace std; void construct_network(int H, int W, int K){ vector<int> query(H*W); int counter=H*W; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ vector<int> a; for(int p=i;p<H&&p<=i+K;p++){ int p2=K+i-p+j; if(p2>=W) continue; a.pb(p*W+p2); } if(a.size()>0){ add_or(a); query[i*W+j]=counter; counter++; } query[i*W+j]=-1; } } vector<int> b; for(int i=0;i<H;i++){ for(int j=0;j<W;j++) if (query[i*W+j]!=-1){ vector<int> a; a.pb(query[i*W+j]); a.pb(i*W+j); add_and(a); b.push_back(counter); counter++; } } if(b.size()==0) continue; add_or(b); }