제출 #897793

#제출 시각아이디문제언어결과실행 시간메모리
897793TrumlingCrocodile's Underground City (IOI11_crocodile)C++14
100 / 100
405 ms89880 KiB
#include "crocodile.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; #define INF 9999999999999999 #define MOD 1000000007 #define round fixed<<setprecision(2)<< int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector<vector<pair<ll,ll>>>g(N+1); for(int i=0;i<M;i++) { g[R[i][0]].pb({R[i][1],L[i]}); g[R[i][1]].pb({R[i][0],L[i]}); } priority_queue<pair<ll,ll>>pq; vector<pair<ll,ll>>dist(N+1,{INF,INF}); for(int i=0;i<K;i++) { dist[P[i]]={0,0}; pq.push({0,P[i]}); } while(!pq.empty()) { ll curr=pq.top().S; ll w=-pq.top().F; pq.pop(); if(dist[curr].S<w) continue; for(auto x:g[curr]) { if(dist[x.F].F> w + x.S) { if(dist[x.F].F!=dist[x.F].S) pq.push({-dist[x.F].F,x.F}); swap(dist[x.F].F,dist[x.F].S); dist[x.F].F=w + x.S; // pq.push({-dist[x.F].F,x.F}); continue; } if(dist[x.F].S> w + x.S) { dist[x.F].S=w + x.S; pq.push({-dist[x.F].S,x.F}); } } } return (int) dist[0].S; }

컴파일 시 표준 에러 (stderr) 메시지

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:45:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   45 |       if(dist[x.F].F!=dist[x.F].S)
      |       ^~
crocodile.cpp:49:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   49 |          swap(dist[x.F].F,dist[x.F].S);
      |          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...