Submission #418508

# Submission time Handle Problem Language Result Execution time Memory
418508 2021-06-05T12:17:53 Z temurbek_khujaev Vision Program (IOI19_vision) C++17
0 / 100
19 ms 1868 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;
int W;
int H;

int code(int i, int j) {
    return (i * W + j);
}

int dist(int a, int b, int c, int d) {
    return (abs(c - a) + abs(b - d));
}

int check_hor() {
    vector<int> v;
    int one_column;
    for (int i = 0; i < W; i++) {
        vector<int> line;
        for (int j = 0; j < H; j++) {
            line.push_back(code(j, i));
        }
        v.push_back(add_xor(line));
    }
    one_column = add_or(v);

    int consecutive_row;
    vector<int> row_has;
    for (int i = 0; i < H; i++) {
        vector<int> row;
        for (int j = 0; j < W; j++) row.push_back(code(i, j));
        row_has.push_back(add_or(row));
    }
    vector<int> consecutive;
    for (int i = 1; i < H; i++) {
        consecutive.push_back(add_and({row_has[i - 1], row_has[i]}));
    }
    consecutive_row = add_or(consecutive);
    return add_and({one_column, consecutive_row});
}

int check_ver() {
    vector<int> v;
    int one_column;
    for (int j = 0; j < H; j++) {
        vector<int> line;
        for (int i = 0; i < W; i++) {
            line.push_back(code(j, i));
        }
        v.push_back(add_xor(line));
    }
    one_column = add_or(v);

    int consecutive_row;
    vector<int> row_has;
    for (int j = 0; j < W; j++) {
        vector<int> row;
        for (int i = 0; i < H; i++) {
            row.push_back(code(i, j));
        }
        row_has.push_back(add_or(row));
    }
    vector<int> consecutive;
    for (int i = 1; i < W; i++) {
        consecutive.push_back(add_and({row_has[i - 1], row_has[i]}));
    }
    consecutive_row = add_or(consecutive);
    return add_and({one_column, consecutive_row});
}

void construct_network(int H, int W, int K) {
    ::W = W;
    ::H = H;

    add_or({check_hor(), check_ver()});
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1868 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -