제출 #955045

#제출 시각아이디문제언어결과실행 시간메모리
9550453as8사이버랜드 (APIO23_cyberland)C++17
8 / 100
23 ms7388 KiB
#include "cyberland.h" #include <bits/stdc++.h> #include <vector> #define pll pair<ll, ll> #define ll long long using namespace std; struct node { ll v, w; }; void dijkstra(vector<vector<node> >& graph, vector<ll>& distances, vector<int>& t, ll startIndex) { priority_queue<pll, vector<pll>, greater<> > Q; distances[startIndex] = 0; Q.push({0, startIndex}); for(int i = 0; i < graph.size(); i++) { if(i == startIndex) continue; if(t[i] == 0) { distances[i] = 0; Q.push({0, startIndex}); } } while(!Q.empty()) { ll node = Q.top().second, dist = Q.top().first; Q.pop(); if(distances[node] < dist) continue; for(auto [v, w] : graph[node]) { if(distances[node] + w < distances[v]) { distances[v] = distances[node] + w; Q.push({distances[v], 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) { vector<vector<node> > graph(N); for(int i = 0; i < M; i++) { graph[x[i]].push_back({y[i], c[i]}); graph[y[i]].push_back({x[i], c[i]}); } vector<ll> distances(N, LLONG_MAX); dijkstra(graph, distances, arr, 0); return distances[H]; }

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

cyberland.cpp: In function 'void dijkstra(std::vector<std::vector<node> >&, std::vector<long long int>&, std::vector<int>&, long long int)':
cyberland.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<node> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i = 0; i < graph.size(); i++) {
      |                    ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...