Submission #1049645

#TimeUsernameProblemLanguageResultExecution timeMemory
1049645nisanduuKeys (IOI21_keys)C++17
Compilation error
0 ms0 KiB
#include <vector> #include <bits/stdc++.h> using namespace std; ll dfs(ll node,vector<ll> vis,vector<vector<ll>> adj){ vis[node]=1; int am = 1; for(auto el:adj[node]){ if(!vis[node]){ am += dfs(el,vis,adj); } } return am; } vector<int> find_reachable(vector<int> r, vector<int> u, vector<int> v, vector<int> c) { vector<int> ans(r.size(), 0); int n = r.size(); int m = v.size(); vector<vector<ll>> adj(n+2); for(ll i=0;i<m;i++){ adj[v[i]].push_back(u[i]); adj[u[i]].push_back(v[i]); } int mini = 1e9; int type = c[0]; for(int i=0;i<n;i++){ if(r[i]==type) { vector<ll> vis(n+2); ans[i] = dfs(i,vis,adj); }else{ ans[i] = 1; } mini = min(mini,ans[i]); } for(int i=0;i<n;i++) ans[i] = ans[i]==mini ? 1 : 0; return ans; }

Compilation message (stderr)

keys.cpp:6:1: error: 'll' does not name a type
    6 | ll dfs(ll node,vector<ll> vis,vector<vector<ll>> adj){
      | ^~
keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:21:16: error: 'll' was not declared in this scope
   21 |  vector<vector<ll>> adj(n+2);
      |                ^~
keys.cpp:21:16: error: template argument 1 is invalid
keys.cpp:21:16: error: template argument 2 is invalid
keys.cpp:21:18: error: template argument 1 is invalid
   21 |  vector<vector<ll>> adj(n+2);
      |                  ^~
keys.cpp:21:18: error: template argument 2 is invalid
keys.cpp:22:8: error: expected ';' before 'i'
   22 |  for(ll i=0;i<m;i++){
      |        ^~
      |        ;
keys.cpp:22:13: error: 'i' was not declared in this scope
   22 |  for(ll i=0;i<m;i++){
      |             ^
keys.cpp:30:19: error: template argument 2 is invalid
   30 |          vector<ll> vis(n+2);
      |                   ^
keys.cpp:31:19: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   31 |          ans[i] = dfs(i,vis,adj);
      |                   ^~~
      |                   ffs