Submission #1350859

#TimeUsernameProblemLanguageResultExecution timeMemory
1350859Desh03Vision Program (IOI19_vision)C++20
32 / 100
2 ms1728 KiB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

void construct_network(int h, int w, int k) {
    vector<int> col(w), row(h), v;
    for (int i = 0; i < h; i++) {
        v.clear();
        for (int j = 0; j < w; j++) {
            v.push_back(w * i + j);
        }
        row[i] = add_or(v);
    }
    for (int j = 0; j < w; j++) {
        vector<int> v;
        for (int i = 0; i < h; i++) {
            v.push_back(w * i + j);
        }
        col[j] = add_or(v);
    }
    vector<int> x(w), y(h);
    vector<int> vv;
    for (int i = 0; i < h; i++) {
        v.clear();
        for (int j = 0; j < w; j++) {
            v.push_back(w * i + j);
        }
        vv.push_back(add_xor(v));
    }
    y[0] = add_not(add_or(vv));
    vv.clear();
    for (int j = 0; j < w; j++) {
        v.clear();
        for (int i = 0; i < h; i++) {
            v.push_back(w * i + j);
        }
        vv.push_back(add_xor(v));
    }
    x[0] = add_not(add_or(vv));
    for (int dx = w - 1; dx > 0; dx--) {
        if (dx == w - 1) {
            x[dx] = add_and({col[0], col[w - 1]});
            continue;
        }
        vector<int> v;
        for (int j = dx; j < w; j++) {
            v.push_back(add_and({col[j], col[j - dx]}));
        }
        x[dx] = add_or(v);
    }
    for (int dy = h - 1; dy > 0; dy--) {
        if (dy == h - 1) {
            y[dy] = add_and({row[0], row[h - 1]});
            continue;
        }
        vector<int> v;
        for (int j = dy; j < h; j++) {
            v.push_back(add_and({row[j], row[j - dy]}));
        }
        y[dy] = add_or(v);
    }
    v.clear();
    for (int i = max(0, k - h + 1); i <= min(w - 1, k); i++) {
        v.push_back(add_and({x[i], y[k - i]}));
    }
    add_or(v);
}
#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...