Submission #977343

#TimeUsernameProblemLanguageResultExecution timeMemory
977343NexusCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#define ll long long #include <bits/stdc++.h> #include "cyberland.h" using namespace std; const ll N=1e5+9; pair<ll,ll>p; ll vis[N],o[N],g; vector<pair<ll,ll>>v[N]; priority_queue<pair<ll,ll>>q; void dfs(ll node) { if(vis[i])return; vis[node]=1; if(!arr[i])o[i]=1; for(auto i:v[node])dfs(i); } double solve(int n, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { vector<ll>dis(n,1e18); double ans=-1; for(ll i=0;i<n;++i) { o[i]=0; vis[i]=0,v[i].clear(); } dfs(0); for(ll i=0;i<n;++i)vis[i]=0; for(ll i=0;i<M;++i) { v[x[i]].push_back({c[i],y[i]}); v[y[i]].push_back({c[i],x[i]}); } dis[H]=0; q.push({H,0}); while(q.size()) { p=q.top(); g=p.second; q.pop(); if(vis[g])continue; vis[g]=1; if(o[g])dis[0]=min(dis[0],dis[g]); for(auto i:v[g]) { if(dis[g]+i.first<dis[i.second]) { dis[i.second]=dis[g]+i.first; q.push({-dis[i.second],i.second}); } } } if(dis[0]<1e18)ans=dis[0]; return ans; }

Compilation message (stderr)

cyberland.cpp: In function 'void dfs(long long int)':
cyberland.cpp:16:12: error: 'i' was not declared in this scope
   16 |     if(vis[i])return;
      |            ^
cyberland.cpp:18:9: error: 'arr' was not declared in this scope
   18 |     if(!arr[i])o[i]=1;
      |         ^~~
cyberland.cpp:18:13: error: 'i' was not declared in this scope
   18 |     if(!arr[i])o[i]=1;
      |             ^
cyberland.cpp:19:28: error: cannot convert 'std::pair<long long int, long long int>' to 'long long int'
   19 |     for(auto i:v[node])dfs(i);
      |                            ^
      |                            |
      |                            std::pair<long long int, long long int>
cyberland.cpp:14:13: note:   initializing argument 1 of 'void dfs(long long int)'
   14 | void dfs(ll node)
      |             ^