#include "cyberland.h"
#include<bits/stdc++.h>
#define db double
#define pb push_back
#define ft first
#define sd second
using namespace std;
const db INF=1e18+1;
vector<vector<pair<int,db>>>g(1e5);
vector<bool>vis(1e5,0), ar(1e5,0);
vector<int>arr(1e5);
int n, m, k, h;
void dfs(int x){
vis[x]=1;
if (x==h)return;
if (arr[x]==0)ar[x]=1;
for (auto u:g[x]){
if (!vis[u.ft]){
dfs(u.ft);
}
}
}
db pw(db x, int y){
if (!y)return 1;
if (y % 2)return pw(x, y-1)*x;
db tmp=pw(x, y/2);
return tmp*tmp;
}
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> ARR) {
n=N;m=M;k=K;H=h;
for (int i=0; i<n; i++){
g[i].clear();
vis[i]=0;
ar[i]=0;
arr[i]=ARR[i];
}
for (int i=0; i<m; i++){
g[x[i]].pb({y[i],c[i]});
g[y[i]].pb({x[i],c[i]});
}
arr[0]=0;
dfs(0);
vector<int> ls (n, -1);
ls[h] = 0;
vector<bool> u1 (n, 0);
for (int i=0; i<n; ++i) {
int v = -1;
for (int j=1; j<n; ++j)
if (!u1[j] && (v == -1 || ls[j] > ls[v]))
v = j;
if (v==-1||ls[v]==-1)
break;
u1[v] = 1;
for (int j=0; j<(int)g[v].size(); ++j) {
int to = g[v][j].ft;
if (u1[to])continue;
if (arr[to]==2){
ls[to]=max(ls[v]+1,ls[to]);
}else ls[to]=max(ls[v],ls[to]);
}
}
vector<db> d (n, INF);
d[h] = 0;
vector<bool> u (n, 0);
for (int i=0; i<n; ++i) {
int v = -1;
for (int j=0; j<n; ++j)
if (!u[j] && (v == -1 || d[j] < d[v]))
v = j;
if (d[v] == INF)
break;
u[v] = 1;
for (int j=0; j<(int)g[v].size(); ++j) {
int to = g[v][j].ft;
db len = g[v][j].sd;
db k2=pw(2.0,min(ls[v],k));
if (d[v] + (len / k2) < d[to]) {
d[to] = d[v] + len/k2;
}
}
}
db ans = INF;
for (int i=0; i<n; i++){
if (ar[i])ans=min(ans,d[i]);
}
if (ans==INF)return -1;
else return ans;
}
Compilation message
cyberland.cpp:77:2: error: extended character is not valid in an identifier
77 | arr[i]=ARR[i];
| ^
cyberland.cpp:77:5: error: extended character is not valid in an identifier
77 | arr[i]=ARR[i];
| ^
cyberland.cpp:77:8: error: extended character is not valid in an identifier
77 | arr[i]=ARR[i];
| ^
cyberland.cpp:77:11: error: extended character is not valid in an identifier
77 | arr[i]=ARR[i];
| ^
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:77:2: error: '\U000000a0' was not declared in this scope
77 | arr[i]=ARR[i];
| ^