Submission #976852

#TimeUsernameProblemLanguageResultExecution timeMemory
976852AlperenT_Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include "cyberland.h" #include <vector> #include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #define pb push_back #define F first #define S second #define all(a) a.begin(),a.end() #define pii pair <int,int> #define PII pair<pii , pii> #define ld long double #define ll long long #define sz(v) (int)v.size() #define rep(i , a , b) for(int i=a;i <= b;i++) #define per(i , a , b) for(int i=a;i >= b;i--) using namespace std ; const ll maxn = 2e5+10 , N = 1e5 +1 , maxq = 202 , inf = 1e18 , maxk = 2022 , mod =1e9+7 ; ld dis[maxn][102] ;int mark[maxn] ,is[maxn] , is2[maxn]; vector <pair<int,ld> > G[maxn] ; void dfs(int v){ is[v] =1 ; for(auto x : G[v]){ if(is[x.F]==1)continue ; dfs(x.F) ; } } int H ; void dfs2(int v){ is2[v] = 1 ; for(auto x : G[v]){ if(is2[x.F] == 1 ||x.F==)continue ; dfs2(x.F) ; } } ld solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> t) { H = h ; rep(i , 0 , n-1)G[i].clear() ; rep(i , 0, n-1)is[i] = is2[i] =0 ; rep(i , 0 ,m-1){ G[x[i]].pb({y[i] , c[i]}); G[y[i]].pb({x[i] , c[i]}) ; } dfs(h) ; dfs2(0) ; if(is[0]== 0)return -1 ; k = min(k , 100); rep(j , 0 , n-1)rep(z , 0 , k)dis[j][z] = inf ; for(auto x : G[h]){ dis[x.F][0] = x.S; } ld ans =inf; rep(i , 0 , k){ priority_queue <pair<ld,int> > pq ; rep(j , 0 , n-1){ pq.push({-dis[j][i] , j}) ; mark[j] =0 ; } while(sz(pq)){ int v = pq.top().S ;pq.pop(); if(mark[v] == 1)continue; mark[v] = 1; for(auto a : G[v]){ if(a.F == h)continue ; if(dis[a.F][i] > dis[v][i]+a.S){ dis[a.F][i] = dis[v][i] + a.S ; pq.push({-dis[a.F][i] , a.F}); } } } rep(j , 0 , n-1){ rep(z ,0 , sz(G[j])-1){ G[j][z].S /= 2.00000000 ; } } rep(j , 0 , n-1){ if(j == 0 || (t[j] == 0 && is[j] == 1 && is2[j] == 1)){ ans = min(ans , dis[j][i]) ; } } rep(j , 0 , n-1){ if(t[j]==2){ for(auto x : G[j]){ dis[x.F][i+1] = min(dis[j][i] + x.S , dis[x.F][i+1]) ; } } } } return ans ; }

Compilation message (stderr)

cyberland.cpp: In function 'void dfs2(int)':
cyberland.cpp:32:33: error: expected primary-expression before ')' token
   32 |         if(is2[x.F] == 1 ||x.F==)continue ;
      |                                 ^
cyberland.cpp: At global scope:
cyberland.cpp:37:4: error: ambiguating new declaration of 'long double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
   37 | ld solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> t) {
      |    ^~~~~
In file included from cyberland.cpp:1:
cyberland.h:3:8: note: old declaration 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
    3 | 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);
      |        ^~~~~