Submission #968384

#TimeUsernameProblemLanguageResultExecution timeMemory
968384dubabubaCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" #pragma GCC optimize("O3") #pragma GCC target("lzcnt", "popcnt") using namespace std; typedef double dbl; typedef vector<int> vi; typedef long long i64; typedef pair<int, int> pii; #define ff first #define ss second #define MP make_pair template<typename T> void ono_min(T &MIN, T CMP) { if(MIN > CMP) MIN = CMP; } template<typename T> void ono_max(T &MAX, T CMP) { if(MAX < CMP) MAX = CMP; } const int mxk = 32; const int mxn = 1e5 + 10; vector<pii> adj[mxn]; dbl solve(int n, int m, int K, int h, vi x, vi y, vi c, vi arr) { for(int i = 0; i < n; i++) adj[i].clear(); for(int i = 0; i < m; i++) { adj[x[i]].emplace_back(y[i], c[i]); adj[y[i]].emplace_back(x[i], c[i]); } bool in[n]; memset(in, 0, sizeof in); priority_queue<pair<dbl, int>> pq[mxk]; pq[0].push(MP(-0.0, 0)); function<void(int)> dfs; dfs = [&](int u) -> void { if(in[u]) return; in[u] = 1; if(arr[u] == 0) pq[0].push(MP(-0.0, u)); if(u == h) continue; for(pii p : adj[u]) if(!in[p.ff]) dfs(p.ff); }; dfs(0); dbl dis[mxk][n], ans = 1e18; for(int k = 0; k <= K && k < mxk; k++) { memset(in, 0, sizeof in); for(int i = 0; i < n; i++) dis[k][i] = 1e18; while(pq[k].size()) { dbl d = -pq[k].top().ff; int u = pq[k].top().ss; pq[k].pop(); if(in[u]) continue; ono_min(dis[k][u], d); in[u] = 1; if(u == h) continue; for(pii p : adj[u]) { int v = p.ff; dbl w = p.ss; if(v * arr[v] == 0) continue; if(!in[v]) pq[k].push(MP(-(dis[k][u] + w), v)); if(arr[v] == 2 && k + 1 < mxk) pq[k + 1].push(MP(-(dis[k][u] + w) / 2.0, v)); } } ono_min(ans, dis[k][h]); } return (ans < 1e18) ? ans : -1; }

Compilation message (stderr)

cyberland.cpp: In lambda function:
cyberland.cpp:42:14: error: continue statement not within a loop
   42 |   if(u == h) continue;
      |              ^~~~~~~~