이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "cyberland.h"
#include<fstream>
using namespace std;
ifstream fin("VNOICUP.INP");
ofstream fout("VNOICUP.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const int mxn = 1e5;
struct ch{
int u, take; ld dd;
};
struct cmp{
bool operator()(const ch &a, const ch &b){
return(a.dd > b.dd);
}
};
vt<pii>adj[mxn + 1];
ld d[mxn + 1][71];
bool vis[mxn + 1], go[mxn + 1][71];
void dfs(int s){
vis[s] = 1;
for(auto [v, w]: adj[s]){
if(!vis[v])dfs(v);
}
}
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) {
k = min(k, 70);
forr(i, 0, n){
adj[i].clear();
forr(j, 0, k + 1){
d[i][j] = 1e18; go[i][j] = 0;
}
vis[i] = 0;
}
forr(i, 0, m){
int u = x[i], v = y[i], w = c[i];
adj[u].pb({v, w}); adj[v].pb({u, w});
}
dfs(0);
if(!vis[h])return(-1);
priority_queue<ch, vt<ch>, cmp>pq;
for(int i = 0; i < n; i++){
if((i == 0 || !arr[i]) && vis[i]){
d[i][0] = 0; pq.push({i, 0, d[i][0]});
}
}
while(!pq.empty()){
auto [u, take, dd] = pq.top(); pq.pop();
if(go[u][take])continue; go[u][take] = 1;
if(u == h)continue;
for(auto [v, w]: adj[u]){
if(d[v][take] > d[u][take] + w){
d[v][take] = d[u][take] + w;
pq.push({v, take, d[v][take]});
}if(arr[v] == 2 && take < k){
if(d[v][take + 1] > (d[u][take] + w) / 2.0){
d[v][take + 1] = (d[u][take] + w) / 2.0;
pq.push({v, take + 1, d[v][take + 1]});
}
}
}
}
ld ans = 1e18;
for(int i = 0; i <= k; i++)ans = min(ans, d[h][i]);
return(ans);
}
컴파일 시 표준 에러 (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:60:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
60 | if(go[u][take])continue; go[u][take] = 1;
| ^~
cyberland.cpp:60:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
60 | if(go[u][take])continue; go[u][take] = 1;
| ^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |