Submission #1272887

#TimeUsernameProblemLanguageResultExecution timeMemory
1272887BlockOGVision Program (IOI19_vision)C++20
0 / 100
2 ms1600 KiB
#include <bits/stdc++.h>

// mrrrow meeow :3
// go play vivid/stasis now! https://vividstasis.gay

#define fo(i, a, b) for (auto i = (a); i < (b); i++)
#define of(i, a, b) for (auto i = (b); i-- > (a);)
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define be(a) a.begin(), a.end()
using namespace std;

int ____init = [] {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    return 0;
}();

int add_not(int N);
int add_and(vector<int> Ns);
int add_or(vector<int> Ns);
int add_xor(vector<int> Ns);

void construct_network(int h, int w, int k) {
    int curr = h * w;

    vector<int> rdo, rdx;
    of(i, 0, h) {
        vector<int> inputs;
        for (int r = i, c = 0; r < h && c < w; r++, c++) inputs.pb(r * w + c);

        add_or(inputs);
        rdo.pb(curr++);
        add_xor(inputs);
        rdx.pb(curr++);
    }
    fo(i, 1, w) {
        vector<int> inputs;
        for (int r = 0, c = i; r < h && c < w; r++, c++) inputs.pb(r * w + c);

        add_or(inputs);
        rdo.pb(curr++);
        add_xor(inputs);
        rdx.pb(curr++);
    }

    vector<int> ldo, ldx;
    fo(i, 0, w) {
        vector<int> inputs;
        for (int r = 0, c = i; r < h && c < w; r++, c--) inputs.pb(r * w + c);

        add_or(inputs);
        ldo.pb(curr++);
        add_xor(inputs);
        ldx.pb(curr++);
    }
    fo(i, 1, h) {
        vector<int> inputs;
        for (int r = i, c = w - 1; r < h && c < w; r++, c--) inputs.pb(r * w + c);

        add_or(inputs);
        ldo.pb(curr++);
        add_xor(inputs);
        ldx.pb(curr++);
    }

    vector<int> kordt;
    fo(i, 0, rdo.size() - k - 1) {
        vector<int> inputs;
        fo(j, 0, k + 1) inputs.pb(rdo[i + j]);

        add_or(inputs);
        inputs.pb(curr++);
        add_xor(inputs);
        kordt.pb(curr++);
    }

    vector<int> krdt;
    fo(i, 0, rdo.size() - k) {
        vector<int> inputs;
        fo(j, 0, k) inputs.pb(rdo[i + j]);

        add_or(inputs);
        inputs.pb(curr++);
        add_xor(inputs);
        kordt.pb(curr++);
    }

    vector<int> koldt;
    fo(i, 0, ldo.size() - k - 1) {
        vector<int> inputs;
        fo(j, 0, k + 1) inputs.pb(ldo[i + j]);

        add_or(inputs);
        inputs.pb(curr++);
        add_xor(inputs);
        koldt.pb(curr++);
    }

    vector<int> kldt;
    fo(i, 0, ldo.size() - k) {
        vector<int> inputs;
        fo(j, 0, k) inputs.pb(ldo[i + j]);

        add_or(inputs);
        inputs.pb(curr++);
        add_xor(inputs);
        koldt.pb(curr++);
    }

    add_or(krdt);
    add_or(kldt);
    add_or(kordt);
    add_or(koldt);
    add_and({curr++, curr++});
    add_and({curr++, curr++});
    add_not(curr++);
    add_and({curr++, curr++});
}
#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...