제출 #390612

#제출 시각아이디문제언어결과실행 시간메모리
390612SuhaibSawalha1Vision Program (IOI19_vision)C++17
58 / 100
1041 ms8236 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; int dist (array<int, 2> a, array<int, 2> b) { return abs(a[0] - b[0]) + abs(a[1] - b[1]); } void construct_network(int n, int m, int k) { auto val = [&] (int i, int j) { return i * m + j; }; vector<int> OR; if (k == 1) { int row[n], col[m]; int xor_for_rows, xor_for_cols; vector<int> ask_r, ask_c; for (int i = 0; i < n; ++i) { vector<int> p; for (int j = 0; j < m; ++j) { p.push_back(val(i, j)); } ask_r.push_back(row[i] = add_or(p)); } for (int j = 0; j < m; ++j) { vector<int> p; for (int i = 0; i < n; ++i) { p.push_back(val(i, j)); } ask_c.push_back(col[j] = add_or(p)); } xor_for_rows = add_xor(ask_r); add_xor(ask_c); xor_for_cols = add_xor(ask_c); for (int i = 1; i < n; ++i) { OR.push_back(add_and({row[i - 1], row[i], xor_for_cols})); } for (int i = 1; i < m; ++i) { OR.push_back(add_and({col[i - 1], col[i], xor_for_rows})); } } else { int q = 1e4 - 1; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { vector<int> ask; for (int h = i; h < n; ++h) { for (int w = (i == h ? j : 0); w < m; ++w) { if (dist({i, j}, {h, w}) == k) { ask.push_back(val(h, w)); } } } if (ask.size() && q > 1) { q -= 2; OR.push_back(add_and({val(i, j), add_xor(ask)})); } } } } add_or(OR); }
#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...