Submission #1124197

#TimeUsernameProblemLanguageResultExecution timeMemory
1124197jitic22514Werewolf (IOI18_werewolf)C++17
Compilation error
0 ms0 KiB
#include "werewolf.h" #include<bits/stdc++.h> #define ll long long #define pir pair<int,int> #define fi first #define se second using namespace std; const int maxn = 2e5 + 5; template <class t1,class t2> inline void mini(t1 &x,t2 y){if (x > y) x = y;} template <class t1,class t2> inline void maxi(t1 &x,t2 y){if (x < y) x = y;} template <class t1> inline void print_(vector <t1> v){ for (t1 x : v) cout << x << " ";cout << "\n"; } struct query{ int u,v,l,r,id; }; vector <int> vec[maxn]; query Q[maxn]; namespace subtask1{ bool subtask1(int n,int q){ return (n <= 100 && q <= 100); } struct dsu{ int par[maxn]; void init(int n){ for (int i = 1 ; i <= n ; i++) par[i] = i; } int findp(int x){ return (x == par[x]) ? x : par[x] = findp(par[x]); } void add(int u,int v){ par[findp(u)] = findp(v); } bool is_connected(int u,int v){ return findp(u) == findp(v); } } dsu; bool mark[maxn]; int solve(int n,int source,int sink,int l,int r){ dsu.init(n); bool kt = 0; for (int i = l ; i <= r ; i++) mark[i] = 0; //for source for (int u = l ; u < n ; u++) for (int v : vec[u]) if (v >= l) dsu.add(u,v); for (int i = l ; i <= r ; i++) mark[i] = dsu.is_connected(source,i); dsu.init(n); for (int u = r ; u >= 0 ; u--) for (int v : vec[u]) if (v <= r) dsu.add(u,v); for (int i = l ; i <= r ; i++) kt |= (mark[i] && dsu.is_connected(sink,i)); return kt; } vector <int> solve(int n,int q){ vector <int> res; for (int i = 1 ; i <= q ; i++) res.push_back(solve(n,Q[i].u,Q[i].v,Q[i].l,Q[i].r)); return res; } } void get_input(int n,vector <int> X,vector <int> Y, vector <int> S,vector <int> E,vector <int> L, vector <int> R){ for (int i = 0 ; i < X.size() ; i++){ int u = X[i],v = Y[i]; vec[u].push_back(v); vec[v].push_back(u); } for (int i = 0 ; i < S.size() ; i++) Q[i] = {S[i],E[i],L[i],R[i]}; } vector <int> check_validity(int n,vector <int> X,vector <int> Y, vector <int> S,vector <int> E,vector <int> L, vector <int> R){ get_input(n,X,Y,S,E,L,R); int q = S.size(); // if (subtask1::subtask1(n,q)) return subtask1::solve(n,q); } void input(int n,int m,int q){ while (m--){ int u,v; cin >> u >> v; vec[u].push_back(v); vec[v].push_back(u); } for (int i = 1 ; i <= q ; i++){ int u,v,l,r; cin >> u >> v >> l >> r; Q[i] = {u,v,l,r}; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); int n,m,q; /* cin >> n >> m >> q; input(n,m,q); if (subtask1::subtask1(n,q)){ vector <int> r = subtask1::solve(n,q); print_(r); }*/ return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc8lEWtt.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccphxPfT.o:werewolf.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status