QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#139480#2674. Vision programQwerty1232#Compile Error//C++201.2kb2023-08-13 17:32:182024-07-04 01:41:13

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 01:41:13]
  • 评测
  • [2023-08-13 17:32:18]
  • 提交

answer

#include "vision.h"

#include <bits/stdc++.h>

void construct_network(int n, int m, int k) {
    auto get = [&](int i, int j) {
        return i * m + j;
    };
    std::unordered_set<int64_t> set;
    std::vector<std::vector<int>> gr(n * m);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            for (int i1 = 0; i1 < n; i1++) {
                for (int j1 = 0; j1 < m; j1++) {
                    // if (abs(i - i1) + abs(j - j1) == k && !set.count(get(i, j) * n * m + get(i1, j1))) {
                    if (abs(i - i1) + abs(j - j1) == k && get(i, j) < get(i1, j1)) {
                        // set.insert(get(i, j) * n * m + get(i1, j1));
                        gr[get(i, j)].push_back(get(i1, j1));
                    }
                }
            }
        }
    }
    std::vector<int> vec;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            auto& vc = gr[get(i, j)];
            if (vc.empty()) {
                continue;
            }
            int a = add_or(vc);
            int b = add_and({get(i, j), a});
            vec.push_back(b);
        }
    }
    add_or(vec);
}

Details