Submission #1025407

#TimeUsernameProblemLanguageResultExecution timeMemory
1025407byakkoVision Program (IOI19_vision)C++17
46 / 100
10 ms2136 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; void construct_network(int H, int W, int K) { vector<int> row(H), rowp(H); vector<int> col(W), colp(W); for(int i = 0; i < H; i++) { vector<int> cur; for(int j = 0; j < W; j++) cur.push_back(i*W + j); row[i] = add_or(cur); rowp[i] = add_not(add_xor(cur)); } for(int j = 0; j < W; j++) { vector<int> cur; for(int i = 0; i < H; i++) cur.push_back(i*W + j); col[j] = add_or(cur); colp[j] = add_not(add_xor(cur)); } vector<int> dist_i(K + 1, -1), dist_j(K + 1, -1); for(int d = 0; d <= min(K, H - 1); d++) { vector<int> cur; for(int i = 0; i + d < H; i++) { if(d > 0) cur.push_back(add_and({row[i], row[i + d]})); else { cur.push_back(add_and({row[i], rowp[i]})); } } dist_i[d] = add_or(cur); } for(int d = 0; d <= min(K, W - 1); d++) { vector<int> cur; for(int j = 0; j + d < W; j++) { if(d > 0) cur.push_back(add_and({col[j], col[j + d]})); else { cur.push_back(add_and({col[j], colp[j]})); } } dist_j[d] = add_or(cur); } vector<int> all; for(int i = 0; i <= K; i++) { if(dist_i[i] == -1) break; int j = K - i; if(dist_j[j] == -1) continue; all.push_back(add_and({dist_i[i], dist_j[j]})); } add_or(all); }
#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...