Submission #1037171

# Submission time Handle Problem Language Result Execution time Memory
1037171 2024-07-28T09:49:58 Z shmax Vision Program (IOI19_vision) C++17
26 / 100
6 ms 1116 KB
#include "vision.h"

#include <bits/stdc++.h>

using namespace std;
#define all(x) x.begin(), x.end()
#define len(x) (int)(x.size())

template<typename T>
using vec = vector<T>;

void construct_network(int H, int W, int K) {


    if (min(H,W) == 1) {
        vec<int> vals;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                for (int i1 = 0; i1 < H; i1++) {
                    for (int j1 = 0; j1 < W; j1++) {
                        if (abs(i1 - i) + abs(j1 - j) == K) {
                            vals.push_back(add_and({i * W + j, i1 * W + j1}));
                        }
                    }
                }
            }
        }
        add_or(vals);

        return;
    }



//    std::vector<int> Ns;
//    Ns = {0, 1};
//    int a = add_and(Ns);
//    Ns = {0, a};
//    int b = add_or(Ns);
//    Ns = {0, 1, b};
//    int c = add_xor(Ns);
//    add_not(c);
    vec<int> rows;
    vec<int> columns;
    for (int i = 0; i < H; i++) {
        vec<int> v;
        for (int j = 0; j < W; j++) {
            v.push_back(i * W + j);
        }
        rows.push_back(add_or(v));
    }
    for (int i = 0; i < W; i++) {
        vec<int> v;
        for (int j = 0; j < H; j++) {
            v.push_back(j * W + i);
        }
        columns.push_back(add_or(v));
    }
    vec<int> pair_rows;
    vec<int> pair_columns;
    for (int i = 1; i < len(rows); i++) {
        pair_rows.push_back(add_and({rows[i], rows[i - 1]}));
    }
    for (int i = 1; i < len(columns); i++) {
        pair_columns.push_back(add_and({columns[i], columns[i - 1]}));
    }

    int xor1 = add_xor(rows);
    int xor2 = add_xor(columns);
    int t1 = add_or(pair_rows);
    int t2 = add_or(pair_columns);
    int ans1 = add_and({xor1, t2});
    int ans2 = add_and({xor2, t1});
    add_or({ans1, ans2});
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 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 5 ms 1116 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 436 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 3 ms 856 KB Output is correct
9 Correct 6 ms 1116 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
7 Halted 0 ms 0 KB -