Submission #317736

#TimeUsernameProblemLanguageResultExecution timeMemory
317736Jarif_RahmanVision Program (IOI19_vision)C++17
66 / 100
12 ms1152 KiB
#include "vision.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int h, w, k; int cell(int i, int j){ return i*w+j; } void p8(){ vector <int> v; for(int i = 0; i <= k; i++){ int j = k-i; if(i >= h || j >= w) continue; v.pb(add_and({0, cell(i, j)})); } add_or(v); } void construct_network(int H, int W, int K){ h = H, w = W, k = K; if(k > 1 && max(h, w) > 30 && min(h, w) > 1){ p8(); return; } vector<int> hh, ww; for(int i = 0; i < h; i++){ vector<int> temp; for(int j = 0; j < w; j++) temp.pb({cell(i, j)}); hh.pb(add_or(temp)); } for(int j = 0; j < w; j++){ vector<int> temp; for(int i = 0; i < h; i++) temp.pb({cell(i, j)}); ww.pb(add_or(temp)); } vector<int> hw = hh; hw.insert(hw.end(), ww.begin(), ww.end()); int in1 = add_xor(hw); vector<int> v; for(int kk = 0; kk <= k; kk++){ int a = kk, b = k-kk; if(a >= h || b >= w) continue; vector<int> sh, sw; for(int i = 0; i < h-a; i++) sh.pb(add_and({hh[i], hh[i+a]})); for(int i = 0; i < w-b; i++) sw.pb(add_and({ww[i], ww[i+b]})); if(a == 0) v.pb(add_and({in1, add_or(sw)})); else if(b == 0) v.pb(add_and({add_or(sh), in1})); else v.pb(add_and({add_or(sh), add_or(sw)})); } add_or(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...