Submission #281546

#TimeUsernameProblemLanguageResultExecution timeMemory
281546NONAMEVision Program (IOI19_vision)C++14
33 / 100
5 ms1148 KiB
#include "vision.h"

void construct_network(int H, int W, int K) {
    std::vector <int> res;

    if (K == 1) {
        for (int x = 0; x < H; ++x)
        for (int y = 0; y < W; ++y) {
            if (y + 1 < W) {
                add_and({x * W + y, x * W + y + 1});
                res.push_back(H * W + (int)(res.size()));
            }
            if (x + 1 < H) {
                add_and({x * W + y, (x + 1) * W + y});
                res.push_back(H * W + (int)(res.size()));
            }
        }
    } else {
        for (int x1 = 0; x1 < H; ++x1)
        for (int y1 = 0; y1 < W; ++y1)
        for (int x2 = 0; x2 < H; ++x2)
        for (int y2 = 0; y2 < W; ++y2) {
            if ((abs(x1 - x2) + abs(y1 - y2)) != K)
                continue;

            add_and({x1 * W + y1, x2 * W + y2});

            res.push_back(H * W + (int)(res.size()));
        }
    }

    add_or(res);
}
#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...