Submission #830275

#TimeUsernameProblemLanguageResultExecution timeMemory
830275pavementVision Program (IOI19_vision)C++17
46 / 100
7 ms1236 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; #define pb push_back void construct_network(int H, int W, int K) { auto conv = [&](int r, int c) { return r * W + c; }; vector<int> row(H), col(W), fin_row(H), fin_col(W); vector<vector<int> > rows(H), cols(W); int ins = H * W; for (int i = 0; i < H; i++) { vector<int> cur; for (int j = 0; j < W; j++) { cur.pb(conv(i, j)); } add_or(cur); row[i] = ins++; } for (int i = 0; i < W; i++) { vector<int> cur; for (int j = 0; j < H; j++) { cur.pb(conv(j, i)); } add_or(cur); col[i] = ins++; } for (int i = 0; i < H; i++) { for (int j = i + 1; j < H; j++) { if (j - i <= K) { add_and({row[i], row[j]}); rows[j - i].pb(ins++); } } } { for (int i = 1; i < H; i++) { if (!rows[i].empty()) { add_or(rows[i]); fin_row[i] = ins++; } } vector<int> tmp; for (int i = 0; i < H; i++) { tmp.pb(row[i]); } add_xor(tmp); fin_row[0] = ins++; } for (int i = 0; i < W; i++) { for (int j = i + 1; j < W; j++) { if (j - i <= K) { add_and({col[i], col[j]}); cols[j - i].pb(ins++); } } } { for (int i = 1; i < W; i++) { if (!cols[i].empty()) { add_or(cols[i]); fin_col[i] = ins++; } } vector<int> tmp; for (int i = 0; i < W; i++) { tmp.pb(col[i]); } add_xor(tmp); fin_col[0] = ins++; } vector<int> fin; for (int i = 0; i <= K; i++) { int j = K - i; if (0 <= i && i < H && 0 <= j && j < W) { add_and({fin_row[i], fin_col[j]}); fin.pb(ins); ins++; } } add_or(fin); }
#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...