Submission #727632

# Submission time Handle Problem Language Result Execution time Memory
727632 2023-04-21T03:54:43 Z PixelCat Vision Program (IOI19_vision) C++14
0 / 100
4 ms 2128 KB
#include "vision.h"
#ifdef NYAOWO
#include "grader.cpp"
#endif
 
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i,a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using LL = long long;
using pii = pair<int, int>;
 
const int MAXN = 410;
const int MAXLG = 9;

vector<vector<int>> dia1; // x + y, [0, H + W - 2]
vector<vector<int>> dia2; // x - y + W - 1, [0, H + W - 2]
int xor1[MAXN], xor2[MAXN];
int or1[MAXN][MAXLG], or2[MAXN][MAXLG];

int check(int k) {
    int lg = __lg(k);
    int n = sz(dia1);

    vector<int> v;
    For(i, 0, n - k - 1) {
        vector<int> q;
        For(j, 0, k) q.insert(q.end(), all(dia1[i + j]));
        // or = 1, xor = 0  =>  2 black cells
        v.eb(add_xor({
            add_or({or1[i][lg], or1[i + k - (1 << lg)][lg]}),
            add_xor({xor1[i], xor1[i + k + 1]})
        }));
    }
    int a = add_or(v);

    v.clear();
    For(i, 0, n - k - 1) {
        vector<int> q;
        For(j, 0, k) q.insert(q.end(), all(dia2[i + j]));
        // or = 1, xor = 0  =>  2 black cells
        v.eb(add_xor({
            add_or({or2[i][lg], or2[i + k - (1 << lg)][lg]}),
            add_xor({xor2[i], xor2[i + k + 1]})
        }));
    }
    int b = add_or(v);

    return add_and({a, b});
}

void construct_network(int H, int W, int K) {
    // 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);
    int n = H + W - 1;
    dia1.resize(n);
    dia2.resize(n);
    For(i, 0, H - 1) For(j, 0, W - 1) {
        int id = i * W + j;
        dia1[i + j].eb(id);
        dia2[i - j + W - 1].eb(id);
    }

    For(i, 0, n - 1) {
        if(i) dia1[i].eb(xor1[i]);
        xor1[i + 1] = add_xor(dia1[i]);
        if(i) dia1[i].pop_back();

        if(i) dia2[i].eb(xor2[i]);
        xor2[i + 1] = add_xor(dia2[i]);
        if(i) dia2[i].pop_back();
    }
    For(i, 0, n - 1) {
        or1[i][0] = add_or(dia1[i]);
        or2[i][0] = add_or(dia2[i]);
        For(j, 0, MAXLG - 2) {
            or1[i][j + 1] = or1[i][j];
            or2[i][j + 1] = or2[i][j];
            if(i + (1 << j) < n) {
                or1[i][j + 1] = add_or({or1[i][j], or1[i + (1 << j)][j]});
                or2[i][j + 1] = add_or({or2[i][j], or2[i + (1 << j)][j]});
            }
        }
    }

    int a = check(K);
    int b = check(K - 1);
    b = add_not(b);
    add_and({a, b});
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 724 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2128 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -