Submission #316460

#TimeUsernameProblemLanguageResultExecution timeMemory
316460kylych03Vision Program (IOI19_vision)C++14
52 / 100
9 ms1148 KiB
#include "vision.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
void construct_network(int H, int W, int K) {
    vector<int> vec;

    if( (H < 31 && W < 31) || (H==1 || W==1) ){
        for(int i  = 0 ; i < H; i++ ){
            for(int j = 0 ; j < W; j++){
                vector <int> v,v1;
                for(int t = i; t< H; t++)
                    for(int p = 0 ; p < W; p++)
                        if(abs (t - i) + abs(p - j) == K){
                            int p2 = t*W + p;
                            v.push_back(p2);
                        }
                int p1 = i*W + j;
                v1.push_back(p1);
                if(v.size()== 0)
                    continue;
                v1.push_back( add_or(v));
                vec.push_back( add_and(v1) );
            }
        }
        add_or(vec);
        return ;
    }
    if(H < 101 && W <101 ){
        vector <int> h,w;
        for(int i  = 0 ; i < H; i++ ){
           vector <int> v;
           for(int j = 0 ; j < W; j++){
             v.push_back(i * W + j);
           }
           h.push_back(add_or(v));
        }

        for(int i  = 0 ; i < W; i++ ){
           vector <int> v;
           for(int j = 0 ; j < H; j++){
             v.push_back(j * W + i);
           }
           w.push_back(add_or(v));
        }
        int th = add_xor(h);
        int tw = add_xor(w);
        for(int i  =0 ; i < H-K ; i++)
            vec.push_back(add_and( {tw, h[i], h[i+K]}));

        for(int i  =0 ; i < W-K ; i++)
            vec.push_back(add_and( {th, w[i], w[i+K]}));

        for(int i  = 1; i < K ;i++){
            int x = i ;
            int y = K - i;
            vector <int > v1, v2;
            for(int j = 0; j + x < H; j++)
                v1.push_back(add_and({h[j], h[j+x]}));

            for(int j = 0; j + y < W; j++)
                v2.push_back(add_and({w[j], w[j+y]}));
            vec.push_back( add_and({ add_or(v1), add_or(v2)}));
        }
        add_xor(vec);
        return ;
    }
    vector <int> v;
    for(int i  = 0 ; i < H; i++ )
            for(int j = 0 ; j < W; j++)
                if(j + i == K){
                    v.push_back(i*W + j);
                }

	add_or(v);
	//add_not(c);
}
#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...