Submission #418516

# Submission time Handle Problem Language Result Execution time Memory
418516 2021-06-05T12:24:36 Z temurbek_khujaev Vision Program (IOI19_vision) C++17
0 / 100
23 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 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_not(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_not(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;
    if (H == 1) check_hor();
    else if (W == 1) check_ver();
    else
        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 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 1868 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 5 ms 460 KB Output is correct
5 Incorrect 1 ms 204 KB WA in grader: Instruction with no inputs
6 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 -