Submission #617768

# Submission time Handle Problem Language Result Execution time Memory
617768 2022-08-01T13:53:48 Z lorenzoferrari Vision Program (IOI19_vision) C++17
0 / 100
6 ms 1360 KB
#include "vision.h"
#include <vector>
#include <cassert>
using namespace std;

void construct_network(int h, int w, int k) {
    int fid = add_xor({0,0});
    vector<int> rows(h);
    vector<int> cols(w);
    for (int i = 0; i < h; ++i) {
        vector<int> q;
        for (int j = 0; j < w; ++j) {
            q.push_back(i*w + j);
        }
        rows[i] = add_or(q);
    }
    for (int j = 0; j < w; ++j) {
        vector<int> q;
        for (int i = 0; i < h; ++i) {
            q.push_back(i*w + j);
        }
        cols[j] = add_or(q);
    }

    auto add_fixed = [&](vector<int> v, int d) -> int {
        if (d >= (int)v.size()) return fid;
        vector<int> tor;
        for (int i = 0; i + d < (int)v.size(); ++i) {
            tor.push_back(add_and({v[i], v[i+d]}));
        }
        return add_or(tor);
    };

    vector<int> dh(h+1);
    vector<int> dw(w+1);
    for (int i = 1; i <= h; ++i) dh[i] = add_fixed(rows, i);
    for (int i = 1; i <= w; ++i) dw[i] = add_fixed(cols, i);

    vector<int> nh(h);
    vector<int> nw(w);
    for (int i = 1; i <= h; ++i) nh[i-1] = add_not(dh[i]);
    for (int i = 1; i <= w; ++i) nw[i-1] = add_not(dw[i]);
    dh[0] = add_and(nh);
    dw[0] = add_and(nw);

    vector<int> tor;
    for (int i = 0; i <= k; ++i) {
        tor.push_back(add_and({dh[i], dw[k - i]}));
    }

    add_or(tor);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB on inputs (0, 0), (1, 0), expected 0, but computed 1
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB on inputs (0, 0), (1, 0), expected 0, but computed 1
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB on inputs (0, 0), (1, 0), expected 0, but computed 1
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB on inputs (0, 0), (1, 0), expected 0, but computed 1
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1104 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 6 ms 724 KB Output is correct
4 Incorrect 6 ms 848 KB on inputs (0, 0), (0, 28), expected 0, but computed 1
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1360 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB on inputs (0, 0), (1, 0), expected 0, but computed 1
10 Halted 0 ms 0 KB -