답안 #245636

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245636 2020-07-07T02:24:40 Z Dormi Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
#include "grader.cpp"
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T>
int sz(const T &a){return (int)a.size();}
int h,w,k,n;
vector<int> arr[2],parr[2],sarr[2];
int teans[2][2];
int cp(int x, int y){
    return (x+y)/2*w+(y-x)/2;
}
int check(int rot, int dist){
    vector<int> te;
    for(int i=0;i+dist<n;i++){
        te.push_back(add_and({parr[rot][i],sarr[rot][i+dist]}));
    }
    if(sz(te)==0){
        for(int i=0;i<h*w;i++)te.push_back(i);
        return add_xor(te);
    }
    return add_or(te);
}
void construct_network(int H, int W, int K){
    h=H,w=W,k=K;
    for(int rot=0;rot<=1;rot++) {
        int l = (rot?0:w - 1), r = (rot?0:w - 1);
        for (int i = (rot?0:-(w - 1)); i <= (rot?h-1+w-1:h - 1); i++) {
            vector<int> te;
            for (int j = l; j <= r; j += 2) {
                te.push_back(rot?cp(j,i):cp(i, j));
            }
            arr[rot].push_back(add_or(te));
            if (i >= (rot?w-1:-(w - 1) + (w - 1)))l += 1;
            else l -= 1;
            if (i >= (rot?h-1:-(w - 1) + (h - 1)))r -= 1;
            else r += 1;
        }
        n = sz(arr[rot]);
        parr[rot].push_back(add_or({arr[rot][0]}));
        for (int i = 1; i < n; i++) {
            parr[rot].push_back(add_or({parr[rot].back(), arr[rot][i]}));
        }
        sarr[rot].resize(n);
        sarr[rot][n - 1] = add_or({arr[rot].back()});
        for (int i = n - 2; i >= 0; i--) {
            sarr[rot][i]=add_or({sarr[rot][i + 1], arr[rot][i]});
        }
        teans[rot][0] = check(rot, k + 1), teans[rot][1] = check(rot, k);
    }
    int bad=add_or({teans[0][0],teans[1][0]}),good=add_or({teans[0][1],teans[1][1]});
    add_xor({bad,good});
}

Compilation message

/tmp/ccoR6naL.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cciEe696.o:vision.cpp:(.text.startup+0x0): first defined here
/tmp/ccoR6naL.o: In function `add_not(int)':
grader.cpp:(.text+0x270): multiple definition of `add_not(int)'
/tmp/cciEe696.o:vision.cpp:(.text+0x900): first defined here
/tmp/ccoR6naL.o: In function `add_and(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x490): multiple definition of `add_and(std::vector<int, std::allocator<int> >)'
/tmp/cciEe696.o:vision.cpp:(.text+0x580): first defined here
/tmp/ccoR6naL.o: In function `add_xor(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x650): multiple definition of `add_xor(std::vector<int, std::allocator<int> >)'
/tmp/cciEe696.o:vision.cpp:(.text+0x740): first defined here
/tmp/ccoR6naL.o: In function `add_or(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x810): multiple definition of `add_or(std::vector<int, std::allocator<int> >)'
/tmp/cciEe696.o:vision.cpp:(.text+0x3c0): first defined here
collect2: error: ld returned 1 exit status