Submission #792252

# Submission time Handle Problem Language Result Execution time Memory
792252 2023-07-24T21:32:22 Z skittles1412 Vision Program (IOI19_vision) C++17
0 / 100
2 ms 1568 KB
#include "bits/extc++.h"

using namespace std;

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t;
    ((cerr << " | " << u), ...);
    cerr << endl;
}

#ifdef DEBUG
#define dbg(...)                                              \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
    dbgh(__VA_ARGS__)
#else
#define dbg(...)
#define cerr   \
    if (false) \
    cerr
#endif

#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))

int add_and(vector<int> Ns);
int add_or(vector<int> Ns);
int add_xor(vector<int> Ns);
int add_not(int N);

void construct_network(int n, int m, int kv) {
    int arr[n][m];
    vector<int> rows(n), cols(m);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            arr[i][j] = i * m + j;
        }
    }

    for (int i = 0; i < n; i++) {
        vector<int> cq;
        for (int j = 0; j < m; j++) {
            cq.push_back(arr[i][j]);
        }
        rows[i] = add_or(cq);
    }

    for (int j = 0; j < m; j++) {
        vector<int> cq;
        for (int i = 0; i < n; i++) {
            cq.push_back(arr[i][j]);
        }
        cols[j] = add_or(cq);
    }

    int b_true = -1;

    auto g_true = [&]() -> int {
        if (b_true == -1) {
            b_true = add_or(rows);
        }
        return b_true;
    };

    auto g_diff = [&](const vector<int>& arr) -> vector<int> {
        int n = sz(arr);

        if (n == 1) {
            return {g_true()};
        }

        vector<int> ans(n);
        for (int len = 1; len < n; len++) {
            vector<int> cq;
            for (int i = 0; i + len < n; i++) {
                cq.push_back(add_and({arr[i], arr[i + len]}));
            }
            ans[len] = add_or(cq);
        }

        ans[0] = not(add_or(vector<int>(ans.begin() + 1, ans.end())));

        return ans;
    };

    auto row_diff = g_diff(rows), col_diff = g_diff(cols);

    vector<int> cq;
    for (int rd = 0; rd < n; rd++) {
        int cd = kv - rd;
        if (0 <= cd && cd < m) {
            cq.push_back(add_and({row_diff[rd], col_diff[cd]}));
        }
    }
    add_or(cq);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 Incorrect 1 ms 212 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 Incorrect 1 ms 212 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 Incorrect 1 ms 212 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 Incorrect 1 ms 212 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
6 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 Incorrect 1 ms 212 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1568 KB WA in grader: Too many instructions
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 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
6 Halted 0 ms 0 KB -