답안 #1056807

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056807 2024-08-13T11:25:36 Z kachim2 레지스터 (IOI21_registers) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
vector<vector<long>> tree;
long N; long bst = LONG_MAX;
int main(){
    long n;
    cin >> n;
    N=n;
    tree.resize(n);
    vector<bool> lit(n, 0);
    for(long i = 0; i < n-1; i++){
        long a, b;
        cin >> a >> b;
        tree[a-1].push_back(b-1);
        tree[b-1].push_back(a-1);
    }
    for(long i = 0; i < n; i++){
        long x;cin >> x; lit[i] = x;

    }
    for(int i = 1; i < 1<<(n); i++){
        auto flit = lit;
        int fi = i;
        int cnt = 0;
        long scntl= 0;
        while(fi!=0){
            if(fi&1){
                scntl++;
                for(auto j : tree[cnt]){
                    flit[j] = !flit[j];
                }
                flit[cnt] = ! flit[cnt];
            }
            fi>>=1;
            cnt++;
        }

        bool bad = 0;
        for(int i = 0; i < n; i++) if(flit[i]) bad=1;
        if(!bad){
            bst = min(bst, scntl);
        }
    }
    if(bst == LONG_MAX)
    cout << "imposible";
    else
    cout << bst;


}

Compilation message

/usr/bin/ld: /tmp/ccaOS1rz.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWxkfJw.o:registers.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccaOS1rz.o: in function `main':
grader.cpp:(.text.startup+0x16b): undefined reference to `construct_instructions(int, int, int, int)'
collect2: error: ld returned 1 exit status