Submission #416439

#TimeUsernameProblemLanguageResultExecution timeMemory
416439Bill_00Vision Program (IOI19_vision)C++14
100 / 100
63 ms3996 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; void construct_network(int H, int W, int K){ vector<int>y; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ y.push_back(i*W+j); } } int r=add_xor(y); vector<int>id,id1,u,v; for(int i=0;i<H;i++){ vector<int>row; for(int j=0;j<W;j++){ row.push_back(i*W+j); } u.push_back(add_or(row)); } for(int j=0;j<W;j++){ vector<int>column; for(int i=0;i<H;i++){ column.push_back(i*W+j); } v.push_back(add_or(column)); } for(int i=0;i<H-K-1;i++){ vector<int>row1,row2; for(int j=0;j<=i;j++){ row1.push_back(u[j]); } for(int j=i+K+1;j<H;j++){ row2.push_back(u[j]); } int a=add_or(row1); int b=add_or(row2); id.push_back(add_and({a,b})); } for(int i=0;i<W-K-1;i++){ vector<int>row1,row2; for(int j=0;j<=i;j++){ row1.push_back(v[j]); } for(int j=i+K+1;j<W;j++){ row2.push_back(v[j]); } int a=add_or(row1); int b=add_or(row2); id.push_back(add_and({a,b})); } for(int i=0;i<K;i++){ for(int j=i;j<=(H+W-2-K);j+=K){ vector<int>v,u; for(int k=j;k>=0;k--){ if(k<H && (j-k)<W){ v.push_back(k*W+j-k); } } for(int k=j+K;k>=0;k--){ if(k<H && (j-k+K)<W){ u.push_back(k*W+j-k+K); } } int a,b; if(u.size()) a=add_or(u); else continue; if(v.size()) b=add_or(v); else continue; id1.push_back(add_and({a,b})); } } for(int i=0;i<K;i++){ for(int j=i;j<=(H+W-2-K);j+=K){ vector<int>v,u; for(int k=j;k>=0;k--){ if(k<H && (W-j+k-1)>=0){ v.push_back(k*W+W-j+k-1); } } for(int k=j+K;k>=0;k--){ if(k<H && (W-j-K+k-1)>=0){ u.push_back(k*W+W-j+k-K-1); } } int a,b; if(u.size()) a=add_or(u); else continue; if(v.size()) b=add_or(v); else continue; id1.push_back(add_and({a,b})); } } int a,b; if(id.size()!=0){ a=add_or(id); a=add_not(a); if(id1.size()!=0){ int b=add_or(id1); add_and({a,b}); } else{ add_or({r}); } } else{ if(id1.size()!=0){ add_or(id1); } else add_or({r}); } }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:93:8: warning: unused variable 'b' [-Wunused-variable]
   93 |  int a,b;
      |        ^
#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...