Submission #1015106

#TimeUsernameProblemLanguageResultExecution timeMemory
1015106nisanduuWerewolf (IOI18_werewolf)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; // 1 - Wolf // 0 - Human bool f=0; void dfs1(vector<ll>&arr,vector<vector<ll>>&adj,vector<ll>&vis,ll L,ll R,ll node,ll D){ if(node>L&&node!=D) arr[node]=1; for(auto el:adj[node]){ if(!vis[el]){ vis[el]=1; dfs1(arr,adj,vis,L,R,el,D); } } } void dfs2(vector<ll>&arr,vector<vector<ll>>&adj,vector<ll>&vis,ll L,ll R,ll node,ll E){ if(node<R&&node!=E) { if(arr[node]==1){ f=1; return; } } for(auto el:adj[node]){ if(!vis[el]){ vis[el]=1; dfs2(arr,adj,vis,L,R,el,E); } } } int[] check_validity(int N, int[] X, int[] Y, int[] S, int[] E, int[] L, int[] R){ vector<vector<ll>> adj(N+1); ll M = X.size(); for(ll i=0;i<M;i++){ adj[X[i]].push_back(Y[i]); adj[Y[i]].push_back(X[i]); } ll Q = S.size(); int ans[Q]; for(ll i=0;i<Q;i++){ vector<ll> arr(N+1,-1),vis1(N+1),vis2(N+1); f=0; dfs1(arr,adj,vis1,L[i],R[i],S[i],E[i]); dfs2(arr,adj,vis2,L[i],R[i],E[i],S[i]); vis1[S[i]]=1; vis2[E[i]]=1; if(f){ ans[i]=1; }else{ ans[i]=0; } } return ans; }

Compilation message (stderr)

werewolf.cpp:35:4: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   35 | int[] check_validity(int N, int[] X, int[] Y, int[] S, int[] E, int[]
      |    ^
werewolf.cpp:35:4: error: structured binding declaration cannot have type 'int'
   35 | int[] check_validity(int N, int[] X, int[] Y, int[] S, int[] E, int[]
      |    ^~
werewolf.cpp:35:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
werewolf.cpp:35:4: error: empty structured binding declaration
werewolf.cpp:35:7: error: expected initializer before 'check_validity'
   35 | int[] check_validity(int N, int[] X, int[] Y, int[] S, int[] E, int[]
      |       ^~~~~~~~~~~~~~