Submission #1042223

#TimeUsernameProblemLanguageResultExecution timeMemory
1042223LaMatematica14Vision Program (IOI19_vision)C++17
46 / 100
5 ms1240 KiB
#include <bits/stdc++.h> using namespace std; int add_and(std::vector<int> Ns); int add_or(std::vector<int> Ns); int add_xor(std::vector<int> Ns); int add_not(int N); void construct_network(int H, int W, int K) { int l = H*W, aus = H*W; for(int i = 0; i < H; i++) { vector<int> q(W); iota(q.begin(), q.end(), i*W); add_or(q); aus++; } for(int i = 0; i < W; i++) { vector<int> q(H); for (int j = i, k = 0; k < H; j+= W, k++) { q[k] = j; } add_or(q); aus++; } // [l, l+H) righe, [l+H, W+H) colonne // a che distanza sono le righe?? vector<int> dr(K+1); vector<int> ans; for (int i = l; i < l+H; i++) ans.push_back(i); add_xor(ans); dr[0] = aus; aus++; for (int i = 1; i <= K; i++) { if (H-i <= 0) break; int beg = aus; for(int j = 0; j < H-i; j++) { vector<int> r = {l+j, l+j+i}; add_and(r); aus++; } ans.clear(); for (int j = beg; j < aus; j++) ans.push_back(j); add_or(ans); dr[i] = aus; aus++; } // a che distanza sono le colonne?? vector<int> dc(K+1); ans.clear(); for (int i = l+H; i < l+H+W; i++) ans.push_back(i); add_xor(ans); dc[0] = aus; aus++; for (int i = 1; i <= K; i++) { if (W-i <= 0) break; int beg = aus; for(int j = 0; j < W-i; j++) { vector<int> r = {l+H+j, l+H+j+i}; add_and(r); aus++; } ans.clear(); for (int j = beg; j < aus; j++) ans.push_back(j); add_or(ans); dc[i] = aus; aus++; } int ir = aus; for (int r = 0; r <= K; r++) { if (r >= H) break; if (K-r >= W) continue; vector<int> pr = {dr[r], dc[K-r]}; add_and(pr); aus++; } ans.clear(); for (int i = ir; i < aus; i++) ans.push_back(i); add_or(ans); }
#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...