QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#139493#2674. Vision programQwerty1232#Compile Error//C++201.1kb2023-08-13 18:26:232024-07-04 01:41:13

Judging History

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

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

answer

#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#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;
    };
    if (n * m == 2) {
        add_or({0, 1});
        return;
    }
    int zero = add_and({0, 1, 2});
    int one = add_not(zero);

    std::vector<std::vector<int>> d1(n + m - 1), d2(n + m - 1);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            d1[i + j].push_back(get(i, j));
            d2[i - j + m - 1].push_back(get(i, j));
        }
    }

    auto make_cum = [&](std::vector<std::vector<int>> input) -> std::pair<int, int> {
        int n = input.size();
        std::vector<int> vec(n);
        for (int i = 0; i < n; i++) {
            vec[i] = add_or(input[i]);
        }
        std::vector<int> va;
        for (int i = 0; i + k < n; i++) {
            va.push_back(add_and({vec[i], vec[i + k]}));
        }
        int a = add_or(va);

        return {a, -1};
    };

    auto [a1, b1] = make_cum(d1);
    auto [a2, b2] = make_cum(d2);

    add_and({a1, a2});
}

Details