Submission #538507

#TimeUsernameProblemLanguageResultExecution timeMemory
538507WongChun1234Vision Program (IOI19_vision)C++14
100 / 100
24 ms2736 KiB
#include "vision.h" #include<bits/stdc++.h> using namespace std; const int MAXN=550; int xo[MAXN],yo[MAXN],curr[10],tmpc[10],kval[10],ktmp[10],TRUE,FALSE,lg[MAXN]; vector<int> tmp; void output(int var){ add_not({add_not({var})}); } void construct_network(int H, int W, int K) { // TODO: implementation for (int i=2;i<=440;i++) lg[i]=lg[i/2]+1; for (int i=0;i<H;i++){ tmp.clear(); for (int j=0;j<W;j++) tmp.push_back(i*W+j); xo[i]=add_xor(tmp); } for (int j=0;j<W;j++){ tmp.clear(); for (int i=0;i<H;i++) tmp.push_back(i*W+j); yo[j]=add_xor(tmp); } tmp.clear(); for (int i=0;i<H;i++) for (int j=0;j<W;j++) tmp.push_back(i*W+j); FALSE=add_xor(tmp); for (int i=0;i<=8;i++) curr[i]=FALSE,tmpc[i]=FALSE,kval[i]=FALSE; TRUE=add_or(tmp); //partial xor for (int i=1;i<H;i++) xo[i]=add_xor({xo[i-1],xo[i]}); for (int i=1;i<W;i++) yo[i]=add_xor({yo[i-1],yo[i]}); //calculator for (int i=0;i<H;i++){ tmpc[0]=xo[i]; for (int j=0;j<=lg[i+1];j++){ tmpc[j+1]=add_and({curr[j],tmpc[j]}); curr[j]=add_xor({curr[j],tmpc[j]}); } } for (int i=0;i<W;i++){ tmpc[0]=yo[i]; for (int j=0;j<=lg[i+H+1];j++){ tmpc[j+1]=add_and({curr[j],tmpc[j]}); curr[j]=add_xor({curr[j],tmpc[j]}); } } //k calculator tmp.clear(); for (int i=0;i<=8;i++){ if ((1<<i)&K) tmp.push_back(add_xor({curr[i],TRUE})); else tmp.push_back(add_xor({curr[i],FALSE})); } //output(kval[0]); //return; //for (int i=0;i<=8;i++) tmp.push_back(add_xor({curr[i],kval[i]})); TRUE=add_or(tmp); add_not(TRUE); } /* 2 3 3 0 0 1 2 0 2 1 0 */
#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...