제출 #1026210

#제출 시각아이디문제언어결과실행 시간메모리
1026210HD1Vision Program (IOI19_vision)C++14
14 / 100
10 ms1884 KiB
#include "vision.h"
#include<bits/stdc++.h>
#define sz(x) ll(x.size())
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const ll MAX=1e6;
int n, m, k;
vector<int>s,p,q;
void construct_network(int H, int W, int K){
	n=H;
	m=W;
	k=K;
    if(n==1 || m==1){
        if(n==1){
            for(int j=0; j<m-1; j++){
                s.pb(add_and({j,j+1}));
            }
            add_or(s);
            return;
        }

        for(int i=0; i<n-1; i++){
            s.pb(add_and({i,i+1}));
        }
        add_or(s);
        return;
    }
	for(int j=0; j<m; j++){
		for(int i=0; i<n; i++){
			p.pb(i*m+j);
		}
        q.pb(add_or(p));
        p.clear();
	}
    for(int i=0; i<sz(q)-1; i++){// 2 a 2 columnas
        p.pb(q[i]);
        p.pb(q[i+1]);
        s.pb(add_and(p));
        p.pop_back();
        p.pop_back();
    }
    int pos=add_or(s);//si hay 2 juntitos columnas
    s.clear();
    p.clear();
    q.clear();

    // esto dbe xor 1 si estan en la misma fila
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            p.pb(i*m+j);
        }
        q.pb(add_or(p));
        p.clear();
    }
	s.pb(add_xor(q));
    s.pb(pos);
    int a=add_and(s);

    s.clear();
    p.clear();
    q.clear();

    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            p.pb(i*m+j);
        }
        q.pb(add_or(p));
        p.clear();
    }
    for(int i=0; i<sz(q)-1; i++){
        p.pb(q[i]);
        p.pb(q[i+1]);
        s.pb(add_and(p));
        p.pop_back();
        p.pop_back();
    }
    pos=add_or(s);//si hay 2 juntitos en la misma fila
    s.clear();
    p.clear();
    q.clear();

    // esto dbe xor 1 si estan en la misma columna
    for(int j=0; j<m; j++){
        for(int i=0; i<n; i++){
            p.pb(i*m+j);
        }
        q.pb(add_or(p));
        p.clear();
    }
    s.pb(add_xor(q));
    s.pb(pos);
    int b=add_and(s);
    add_or({b,a});
	return;
}
#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...