Submission #316455

# Submission time Handle Problem Language Result Execution time Memory
316455 2020-10-26T12:01:39 Z kylych03 Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#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-1 ; i++)
            vec.push_back(add_and( {tw, h[i], h[i+K]}));

        for(int i  =0 ; i < W-1 ; 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+x]}));
            vec.push_back( add_and({ add_or(v1), add_or(v2)}));
        }
        add_or(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);
}

Compilation message

/tmp/ccqG9yT9.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccDBw8EM.o:vision.cpp:(.text.startup+0x0): first defined here
/tmp/ccqG9yT9.o: In function `add_not(int)':
grader.cpp:(.text+0x260): multiple definition of `add_not(int)'
/tmp/ccDBw8EM.o:vision.cpp:(.text+0x770): first defined here
/tmp/ccqG9yT9.o: In function `add_xor(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x430): multiple definition of `add_xor(std::vector<int, std::allocator<int> >)'
/tmp/ccDBw8EM.o:vision.cpp:(.text+0x260): first defined here
/tmp/ccqG9yT9.o: In function `add_and(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x5e0): multiple definition of `add_and(std::vector<int, std::allocator<int> >)'
/tmp/ccDBw8EM.o:vision.cpp:(.text+0x410): first defined here
/tmp/ccqG9yT9.o: In function `add_or(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x790): multiple definition of `add_or(std::vector<int, std::allocator<int> >)'
/tmp/ccDBw8EM.o:vision.cpp:(.text+0x5c0): first defined here
collect2: error: ld returned 1 exit status