Submission #233702

#TimeUsernameProblemLanguageResultExecution timeMemory
233702Theo830Werewolf (IOI18_werewolf)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include "werewolf.h" using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; typedef int ll; ll INF = 1e9+7; long long MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ii,ll> #define f(i,a,b) for(ll i = a;i < b;i++) #define rf(i,a,b) for(ll i=a;i>=b;i--) #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define w(t) while(t--) #define c(n); cin>>n; #define p(n) cout<<n; #define pl(n) cout<<n<<"\n"; #define ps(n); cout<<n<<" "; #define F first #define S second #define pb(a) push_back(a) #define all(x) (x).begin(), (x).end() #define ull unsigned long long #define vll vector<ll> #define vii vector<ii> #define mkp make_pair #define ld long double #define arrin(a,n) f(i,0,n){cin>>a[i];} #define arrout(a,n) f(i,0,n){cout<<a[i]<<" ";} #define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n"; #define PI (2*acos(0)) const int N = 1e6+5; vll visit,dist,taken,visit2; vector<vll> adj,adj2; priority_queue<ii,vector<ii>, greater<ii> > pq; ll bit[1005][1005]; ll res = 0; ll siz; ll lcm(ll a,ll b){return (a * b) / __gcd(a,b);} ll gcd(ll a,ll b){return __gcd(a,b);} long long power(long long a,long long b){if(b == 0)return 1;if(b == 1)return a;long long ans = power(a,b/2) % MOD;ans *= ans;ans %= MOD;if(b % 2 == 1)ans *= a;return ans%MOD;} ll inverse(ll x){x%=MOD;return power(x,MOD-2);} void BITup(ll k, ll x,ll pos){while(k <= siz){bit[k][pos]+=x;k += k & -k;}} ll BITq(ll k,ll pos){ll s=0;while(k>=1){s+=bit[k][pos];k -= k &-k;}return s;} struct node{ll lazy,val;}seg[4000000]; struct point{ll x,y;}; void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}} void dfs2(ll v){visit2[v] = 1;for(auto x:adj2[v]){if(!visit2[x])dfs2(x);}} void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}} void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}} void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}} ll mst(ll s){taken.assign(N, 0);prim(s);ll cost = 0;while(!pq.empty()){ii front = pq.top();pq.pop();ll w = front.first;ll u = front.second;if(taken[u]==0)cost += w;prim(u);}return cost;} void YESNO(ll a){if(!!a){pl("YES");}else{pl("NO");}} void filesin(void){freopen("tracing.in","r",stdin);} void filesout(void){freopen("tracing.out","w",stdout);} ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Training vector<int> check_validity(int n, vector<int> x,vector<int> y,vector<int> s,vector<int> e,vector<int> l, vector<int> r){ int q = s.size(); int m = x.size(); vector<int>ans(q); f(i,0,q){ adj.assign(n+5,vll()); adj2.assign(n+5,vll()); f(j,0,n){ if(l[i] <= x[j] && x[j] <= r[i]){ if(y[j] < l[i]){ adj[x[j]].pb(y[j]); adj[y[j]].pb(x[j]); } else{ adj2[x[j]].pb(y[j]); adj2[y[j]].pb(x[j]); } } else if(l[i] <= y[j] && y[j] <= r[i]){ if(x[j] < l[i]){ adj[x[j]].pb(y[j]); adj[y[j]].pb(x[j]); } else{ adj2[x[j]].pb(y[j]); adj2[y[j]].pb(x[j]); } } } visit.assign(n+5,0); visit2.assign(n+5,0); dfs(s[i]); dfs2(e[i]); ans[i] = 0; f(j,l[i],r[i]+1){ ans[i] = max(ans[i],visit[j] == 1 && visit2[j] == 1); } } return ans; }

Compilation message (stderr)

werewolf.cpp: In function 'void dijkstra(ll)':
werewolf.cpp:21:11: error: request for member 'second' in 'v', which is of non-class type 'int'
 #define S second
           ^
werewolf.cpp:51:177: note: in expansion of macro 'S'
 void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
                                                                                                                                                                                 ^
werewolf.cpp:20:11: error: request for member 'first' in 'v', which is of non-class type 'int'
 #define F first
           ^
werewolf.cpp:51:188: note: in expansion of macro 'F'
 void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
                                                                                                                                                                                            ^
werewolf.cpp:20:11: error: request for member 'first' in 'v', which is of non-class type 'int'
 #define F first
           ^
werewolf.cpp:51:199: note: in expansion of macro 'F'
 void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
                                                                                                                                                                                                       ^
werewolf.cpp:21:11: error: request for member 'second' in 'v', which is of non-class type 'int'
 #define S second
           ^
werewolf.cpp:51:216: note: in expansion of macro 'S'
 void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
                                                                                                                                                                                                                        ^
werewolf.cpp:20:11: error: request for member 'first' in 'v', which is of non-class type 'int'
 #define F first
           ^
werewolf.cpp:51:236: note: in expansion of macro 'F'
 void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
                                                                                                                                                                                                                                            ^
werewolf.cpp:20:11: error: request for member 'first' in 'v', which is of non-class type 'int'
 #define F first
           ^
werewolf.cpp:51:241: note: in expansion of macro 'F'
 void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
                                                                                                                                                                                                                                                 ^
werewolf.cpp: In function 'void prim(ll)':
werewolf.cpp:52:73: error: request for member 'first' in 'v', which is of non-class type 'int'
 void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}}
                                                                         ^~~~~
werewolf.cpp:52:96: error: request for member 'second' in 'v', which is of non-class type 'int'
 void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}}
                                                                                                ^~~~~~
werewolf.cpp:52:106: error: request for member 'first' in 'v', which is of non-class type 'int'
 void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}}
                                                                                                          ^~~~~
werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:98:64: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type&, bool)'
             ans[i] = max(ans[i],visit[j] == 1 && visit2[j] == 1);
                                                                ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from werewolf.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
werewolf.cpp:98:64: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'bool')
             ans[i] = max(ans[i],visit[j] == 1 && visit2[j] == 1);
                                                                ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from werewolf.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
werewolf.cpp:98:64: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'bool')
             ans[i] = max(ans[i],visit[j] == 1 && visit2[j] == 1);
                                                                ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from werewolf.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
werewolf.cpp:98:64: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
             ans[i] = max(ans[i],visit[j] == 1 && visit2[j] == 1);
                                                                ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from werewolf.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
werewolf.cpp:98:64: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
             ans[i] = max(ans[i],visit[j] == 1 && visit2[j] == 1);
                                                                ^
werewolf.cpp:65:9: warning: unused variable 'm' [-Wunused-variable]
     int m = x.size();
         ^
werewolf.cpp: In function 'void filesin()':
werewolf.cpp:55:27: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
 void filesin(void){freopen("tracing.in","r",stdin);}
                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
werewolf.cpp: In function 'void filesout()':
werewolf.cpp:56:28: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
 void filesout(void){freopen("tracing.out","w",stdout);}
                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~