Submission #657524

# Submission time Handle Problem Language Result Execution time Memory
657524 2022-11-10T03:33:59 Z abcvuitunggio Werewolf (IOI18_werewolf) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <bitset>
#include <vector>
#include <queue>
using namespace std;
int n,m,q,u,v,s,e,l,r;
vector <int> ke[200001];
bitset <500001> d;
int bfs(){
    d.reset();
    d[s*2+1]=d[e*2]=1;
    queue <int> q;
    q.push(s);
    q.push(e);
    while (!q.empty()){
        int u=q.front();
        q.pop();
        int x=d[u*2]*2+d[u*2+1];
        if (x==3)
            return 1;
        for (int v:ke[u]){
            int y=d[v*2]*2+d[v*2+1],z=(v<=r)*2+(v>=l);
            if (((x|y)!=y)&&((x&z)==x)){
                d[v*2+1]=(x&1)|(y&1);
                d[v*2]=(x>>1)|(y>>1);
                q.push(v);
            }
        }
    }
    return 0;
}
int main(){
    ios_base::sync_with_stdio(NULL);cin.tie(nullptr);
    cin >> n >> m >> q;
    for (int i=1;i<=m;i++){
        cin >> u >> v;
        ke[u].push_back(v);
        ke[v].push_back(u);
    }
    while (q--){
        cin >> s >> e >> l >> r;
        cout << bfs() << '\n';
    }
}

Compilation message

/usr/bin/ld: /tmp/cc2fKEVP.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccnlgNCO.o:werewolf.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc2fKEVP.o: in function `main':
grader.cpp:(.text.startup+0x377): undefined reference to `check_validity(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status