Submission #612711

#TimeUsernameProblemLanguageResultExecution timeMemory
612711definitelynotmeeVision Program (IOI19_vision)C++17
100 / 100
27 ms3388 KiB
#include "vision.h" #include<bits/stdc++.h> #define ff first #define ss second #define all(x) x.begin(),x.end() using namespace std; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename T> using matrix = vector<vector<T>>; void construct_network(int H, int W, int K) { int diag = H+W-1; matrix<int> prin(diag), sec(diag); for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ prin[i+j].push_back(i*W+j); sec[i-j+W-1].push_back(i*W+j); } } // cout << "principal:\n"; // for(int i = 0; i < prin.size(); i++){ // cout << i << ": "; // for(int j : prin[i]){ // cout << "(" << j/W << ',' << j%W << ") "; // } // cout << '\n'; // } // cout << "secundaria:\n"; // for(int i = 0; i < sec.size(); i++){ // cout << i << ": "; // for(int j : sec[i]){ // cout << "(" << j/W << ',' << j%W << ") "; // } // cout << '\n'; // } vector<int> ploc(diag), sloc(diag); int timer = H*W-1; for(int i = 0; i < diag; i++){ vector<int> qry; for(int j : prin[i]){ qry.push_back(j); } add_or(qry); ploc[i] = ++timer; } for(int i = 0; i < diag; i++){ vector<int> qry; for(int j : sec[i]){ qry.push_back(j); } add_or(qry); sloc[i] = ++timer; } vector<int> kloc; for(int i = 0;i + K < diag; i++){ vector<int> q1 = {ploc[i],ploc[i+K]}, q2 = {sloc[i],sloc[i+K]}; kloc.push_back(++timer); kloc.push_back(++timer); add_and(q1); add_and(q2); } vector<int> biggerloc; for(int i = 0; i < diag; i++){ vector<int> q1, q2; for(int j = i+K+1; j < diag; j++){ q1.push_back(ploc[j]); q2.push_back(sloc[j]); } if(q1.size()){ timer++; add_or(q1); add_and({timer,ploc[i]}); biggerloc.push_back(++timer); } if(q2.size()){ timer++; add_or(q2); add_and({timer,sloc[i]}); biggerloc.push_back(++timer); } } if(biggerloc.size()){ add_or(biggerloc); timer++; add_not(timer); timer++; } else { add_or(kloc); timer++; } add_or(kloc); timer++; add_and({timer-1,timer}); }
#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...