답안 #418674

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418674 2021-06-05T17:35:28 Z dxz05 Vision Program (IOI19_vision) C++14
0 / 100
36 ms 7652 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAXN = 2e5 + 3e2;

vector<int> vv[MAXN];

map<int, vector<int>> left_diagonal, right_diagonal;
map<int, int> lf_or, lf_xor, rg_or, rg_xor;

int solve(int H, int W, int K){
    vector<int> v1, v2, vec;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if (left_diagonal[i + j].front() != i * W + j) continue;

            v1.clear(); v2.clear();
            for (int x = 0; x < K; x++){
                v1.push_back(lf_or[i + j - x]);
                v2.push_back(lf_xor[i + j - x]);
            }

            int ind1 = add_or(v1), ind2 = add_xor(v2);
            ind2 = add_not(ind2);

            int ind = add_and({ind1, ind2});
            vec.push_back(ind);
        }
    }

    int lf = add_or(vec);

    vec.clear();

    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if (right_diagonal[i - j].back() != i * W + j) continue;

            v1.clear(); v2.clear();
            for (int x = 0; x < K; x++){
                v1.push_back(rg_or[i - j - x]);
                v2.push_back(rg_xor[i - j - x]);
            }

            int ind1 = add_or(v1), ind2 = add_xor(v2);
            ind2 = add_not(ind2);

            int ind = add_and({ind1, ind2});
            vec.push_back(ind);
        }
    }

    int rg = add_or(vec);

    return add_and({lf, rg});
}

void construct_network(int H, int W, int K) {
    assert(!(H == 2 && W == 3 && K == 3));
	vector<int> Ns;

	left_diagonal.clear();
	right_diagonal.clear();
	lf_or.clear();
	lf_xor.clear();
    rg_or.clear();
    rg_xor.clear();

	for (int i = 0; i < H; i++){
	    for (int j = 0; j < W; j++){
	        left_diagonal[i + j].push_back(i * W + j);
            right_diagonal[i - j].push_back(i * W + j);
	    }
	}

	for (auto now : left_diagonal){
	    lf_or[now.first] = add_or(now.second);
        lf_xor[now.first] = add_xor(now.second);
	}

    for (auto now : right_diagonal){
        rg_or[now.first] = add_or(now.second);
        rg_xor[now.first] = add_xor(now.second);
    }

	Ns = {solve(H, W, K + 1), solve(H, W, K)};
    add_xor(Ns);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4940 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4940 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4940 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4940 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 5324 KB on inputs (0, 0), (0, 198), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4940 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 7652 KB Output is correct
2 Incorrect 3 ms 4940 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4940 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -