Submission #614154

#TimeUsernameProblemLanguageResultExecution timeMemory
614154Bench0310Vision Program (IOI19_vision)C++17
100 / 100
18 ms1680 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; typedef long long ll; void construct_network(int h,int w,int k) { auto cell_id=[&](int r,int c)->int{return (r*w+c);}; auto row_cells=[&](int r)->vector<int> { vector<int> v; for(int j=0;j<w;j++) v.push_back(cell_id(r,j)); return v; }; auto col_cells=[&](int c)->vector<int> { vector<int> v; for(int i=0;i<h;i++) v.push_back(cell_id(i,c)); return v; }; auto twov=[&](vector<int> a,vector<int> b)->vector<int> { for(int x:b) a.push_back(x); return a; }; int rows_idx=add_xor(row_cells(0)); for(int i=1;i<h;i++) add_xor(twov({rows_idx+i-1},row_cells(i))); int cols_idx=add_xor(col_cells(0)); for(int j=1;j<w;j++) add_xor(twov({cols_idx+j-1},col_cells(j))); int zero=rows_idx+h-1; const int L=9; int pos=-1; for(int i=0;i<L;i++) pos=add_xor({zero})-i; for(int o=0;o<h+w;o++) { int x=rows_idx+o; add_and({x}); for(int j=1;j<L;j++) add_and({pos+L+j-1,pos+j-1}); for(int j=0;j<L;j++) add_xor({pos+j,pos+L+j}); pos+=(2*L); } int opt=pos+L; for(int i=0;i<L;i++) { if(k&(1<<i)) add_not(zero); else add_xor({zero}); } for(int i=0;i<L;i++) add_xor({pos+i,opt+i}); int tmp=opt+L; for(int i=0;i<L;i++) add_not(tmp+i); vector<int> v; for(int i=0;i<L;i++) v.push_back(tmp+L+i); add_and(v); }
#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...