This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ll = long long;
using vi = vector<int>;
using ar2 = array<int,2>;
const int mxN = 205;
int n, m;
vi diag[2][mxN*2];
// CHATGPT GO BRRRR
void construct_network(int H, int W, int K) {
int num_pixels = H * W;
// Step 1: Identify all black pixels
// We need to compare every pair of black pixels (since there are only two black pixels)
int result = -1;
for (int i = 0; i < num_pixels; ++i) {
for (int j = i + 1; j < num_pixels; ++j) {
// Compute row and column differences
int row_diff = abs((i / W) - (j / W));
int col_diff = abs((i % W) - (j % W));
// Check if the sum of differences equals K
if (row_diff + col_diff == K) {
// AND operation to check if both pixels i and j are black
int black_pair = add_and({i, j});
// If this is the first result, store it directly
if (result == -1) {
result = black_pair;
} else {
// Otherwise, combine with previous results using OR
result = add_or({result, black_pair});
}
}
}
}
// Step 2: The final result should indicate whether any pair of black pixels has the distance K
// If no pairs were found, ensure the result is set to 0 (false)
if (result == -1) {
int false_result = add_not(0); // NOT 0 will give 1, then NOT 1 will give 0 (false)
result = add_not(false_result);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |