Submission #805411

#TimeUsernameProblemLanguageResultExecution timeMemory
805411Theo830Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; #define f(i,a,b) for(int i = a;i < b;i++) #define ll int #define ii pair<ll,ll> #define id pair<double,ii> #define F first #define S second #define pb push_back priority_queue<id>pq; bool v[100005] = {0}; double dist[100005][70]; vector<vector<ii> >adj; ll H; void dfs(ll idx){ v[idx] = 1; for(auto x:adj[idx]){ if(!v[x.F] && x.F != H){ dfs(x.F); } } } double solve(int n, int m, int k, int h, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) { double ans; H = h; k = min(k,69); adj.assign(n+5,vector<ii>()); f(i,0,n){ v[i] = 0; f(j,0,k+1){ dist[i][j] = 1e18; } } f(i,0,m){ adj[x[i]].pb(ii(y[i],c[i])); adj[y[i]].pb(ii(x[i],c[i])); } dfs(0); f(i,0,n){ if((arr[i] == 0 && v[i]) || i == 0){ pq.push(id(0,ii(i,0)); dist[i][0] = 0; } } ans = 1e18; while(!pq.empty()){ id f = pq.top(); pq.pop(); double w = -f.F; ll u = f.S.F; ll ek = f.S.S; if(dist[u][ek] < w){ continue; } if(arr[u] == 2 && ek+1 <= k){ for(auto x:adj[u]){ if(x.F == h){ ans = min(ans,dist[u][ek]/(double)2 + (double)x.S); } else if(dist[x.F][ek+1] > dist[u][ek]/(double)2 + (double)x.S){ dist[x.F][ek+1] = dist[u][ek]/(double)2 + (double)x.S; pq.push(id(-dist[x.F][ek+1],ii(x.F,ek+1))); } } } for(auto x:adj[u]){ if(x.F == h){ ans = min(ans,dist[u][ek] + x.S); } else if(dist[x.F][ek] > dist[u][ek] + x.S){ dist[x.F][ek] = dist[u][ek] + x.S; pq.push(id(-dist[x.F][ek],ii(x.F,ek))); } } } if(ans == 1e18){ ans = -1; } return ans; }

Compilation message (stderr)

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:42:42: error: expected ')' before ';' token
   42 |                     pq.push(id(0,ii(i,0));
      |                            ~             ^
      |                                          )