답안 #418520

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418520 2021-06-05T12:27:58 Z temurbek_khujaev Vision Program (IOI19_vision) C++17
14 / 100
20 ms 1940 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 || W == 1) {
        vector<int> v;
        for (int i = 1; i < max(H, W); i++) {
            v.push_back(add_and({i - 1, i}));
        }
        add_or(v);
    } else
        add_or({check_hor(), check_ver()});
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1940 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 360 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 12 ms 1100 KB Output is correct
8 Correct 10 ms 1100 KB Output is correct
9 Correct 20 ms 1884 KB Output is correct
10 Correct 1 ms 296 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -