Submission #617751

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



void construct_network(int h, int w, int k) {
    int fid;
    int tid;
    {
        int t = add_not(0);
        tid = add_or({0, t});
        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> q, int d) -> int {
        assert(d > 0);
        vector<int> tor;
        for (int i = 0; i + d < (int)q.size(); ++i) {
            vector<int> qq{q[i], q[i+d]};
            tor.push_back(add_and(qq));
        }
        if (tor.empty()) return fid;
        return add_or(tor);
    };

    vector<int> dh(k+1);
    vector<int> dw(k+1);
    for (int i = 1; i <= k; ++i) {
        dh[i] = add_fixed(rows, i);
        dw[i] = add_fixed(cols, i);
    }
    vector<int> nh(k);
    vector<int> nw(k);
    for (int i = 1; i <= k; ++i) {
        nh[i-1] = add_not(dh[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) {
        vector<int> q{dh[i], dw[k - i]};
        tor.push_back(add_and(q));
    }

    add_or(tor);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:10:9: warning: variable 'tid' set but not used [-Wunused-but-set-variable]
   10 |     int tid;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 284 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 284 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 284 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 284 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 284 KB Output is correct
2 Incorrect 2 ms 1052 KB WA in grader: Too many instructions
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 4 ms 724 KB Output is correct
6 Correct 4 ms 848 KB Output is correct
7 Correct 5 ms 848 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 8 ms 848 KB Output is correct
10 Correct 11 ms 1172 KB Output is correct
11 Incorrect 2 ms 1104 KB WA in grader: Too many instructions
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1060 KB on inputs (57, 107), (59, 108), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 284 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -