제출 #266808

#제출 시각아이디문제언어결과실행 시간메모리
266808dooweyVision Program (IOI19_vision)C++14
100 / 100
33 ms2244 KiB
#include <bits/stdc++.h>
#include "vision.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

const int N = 200;
const int LOG = 8;
int id[N][N];
int bit_val[LOG];

int xi[N], xj[N];

void construct_network(int n, int m, int k) {
	int zero_id = 0;
	vector<int> al;
	for(int i = 0 ; i < n; i ++ ){
        for(int j = 0 ; j < m ; j ++ ){
            id[i][j] = i * m + j;
            al.push_back(id[i][j]);
        }
	}
    zero_id = add_xor(al);
    for(int i = 0 ; i < LOG; i ++ ){
        bit_val[i] = zero_id;
    }
    for(int i = 0 ; i < n; i ++ ){
        vector<int> cur;
        if(i) cur.push_back(xi[i - 1]);
        for(int j = 0 ; j < m ; j ++ )
            cur.push_back(id[i][j]);
        xi[i] = add_xor(cur);
    }
    for(int i = 0 ;i < m ; i ++ ){
        vector<int> cur;
        if(i) cur.push_back(xj[i - 1]);
        for(int j = 0 ; j < n; j ++ ){
            cur.push_back(id[j][i]);
        }
        xj[i] = add_xor(cur);
    }
    vector<int> lis;
    for(int i = 0 ; i < n; i ++ )
        lis.push_back(xi[i]);
    for(int i = 0 ; i < m; i ++ ){
        lis.push_back(xj[i]);
    }
    int nw;
    for(auto &x : lis){
        for(int i = 0 ; i < LOG; i ++ ){
            nw = add_and({x, bit_val[i]});
            bit_val[i] = add_xor({bit_val[i], x});
            x = nw;
        }
    }
    int res = add_not(zero_id);
    for(int i = 0 ; i < LOG; i ++ ){
        if((k & (1 << i))){
            res = add_and({res, bit_val[i]});
        }
        else{
            res = add_and({res, add_not(bit_val[i])});
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...