QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#506530 | #6660. 택시 여행 | Crying | Compile Error | / | / | C++14 | 1.2kb | 2024-08-05 18:58:11 | 2024-08-05 18:58:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN = 2010,INF = 1e18;
template<typename T>void tomin(T& x,T y){x = min(x,y);}
template<typename T>void tomax(T& x,T y){x = max(x,y);}
typedef vector<ll> vec; typedef vector<int> vi; typedef array<ll,2> pr;
int n,vis[MAXN]; ll a[MAXN],b[MAXN],dis[MAXN];
vector<pr> e[MAXN];
priority_queue<pr> pq;
void ext(int u,int fa,int p,ll dis){
ll w = a[p] * dis + b[p] + ::dis[p];
if(w > dis[u]){
dis[u] = w;
pq.push((pr){-w,u});
}
for(auto [v,w] : e[u])if(v != fa)ext(v,u,p,dis + w);
}
vec travel(vec A,vi B,vi U,vi V,vi W){
n = A.length();
for(int i=1;i<=n;i++)a[i] = A[i-1],b[i] = B[i-1];
for(int i=0;i<n;i++){
int u = U[i],v = V[i],w = W[i];
u++; v++;
e[u].push_back({v,w}); e[v].push_back({u,w});
}
fill(dis+1,dis+1+n,INF);
dis[1] = 0; pq.push((pr){0,1});
while(pq.size()){
pr now = pq.top(); pq.pop();
int u = now[1]; if(vis[u])continue;
vis[u] = 1;
ext(u,0,u,0);
}
//
vec ans; for(int i=2;i<=n;i++)ans.push_back(dis[i]); return ans;
}
詳細信息
answer.code: In function ‘void ext(int, int, int, ll)’: answer.code:15:15: error: invalid types ‘ll {aka long long int}[int]’ for array subscript 15 | if(w > dis[u]){ | ^ answer.code:16:12: error: invalid types ‘ll {aka long long int}[int]’ for array subscript 16 | dis[u] = w; | ^ answer.code:19:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 19 | for(auto [v,w] : e[u])if(v != fa)ext(v,u,p,dis + w); | ^ answer.code: In function ‘vec travel(vec, vi, vi, vi, vi)’: answer.code:23:11: error: ‘vec’ {aka ‘class std::vector<long long int>’} has no member named ‘length’ 23 | n = A.length(); | ^~~~~~