Submission #565612

#TimeUsernameProblemLanguageResultExecution timeMemory
565612almothana05Evacuation plan (IZhO18_plan)C++14
23 / 100
398 ms24132 KiB
#include<bits/stdc++.h> #define mod 1000000007 ////////////////////////////////////////////////////////// #define inf 100000000000000000 using namespace std; vector<pair<int , int > >gr[300000]; priority_queue<pair<int , int> >q; int dis[300000]; void bfs(){ while(q.size()){ int jet = q.top().second , cmp = -q.top().first; q.pop(); for(int i = 0 ; i < gr[jet].size() ; i++){ if(cmp + gr[jet][i].second < dis[gr[jet][i].first]){ dis[gr[jet][i].first] = cmp + gr[jet][i].second; q.push({-dis[gr[jet][i].first] , gr[jet][i].first}); } } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int menge , numm , nummer , que , ed , npp; for(int i = 0 ; i < 300000 ; i++){ dis[i] = mod; } cin >> menge >> ed; for(int i = 0 ; i < ed ; i++){ cin >> numm >> nummer >> que; gr[numm].push_back({nummer , que}); gr[nummer].push_back({numm , que}); } cin >> npp; for(int i = 0 ; i < npp ; i++){ cin >> numm; dis[numm] = 0; q.push({0 , numm}); } bfs(); for(int i = 1 ; i <= menge ; i++){ // cout << dis[i] << ' '; } cin >> que; while(que--){ cin >> numm >> nummer; cout << min(dis[numm] , dis[nummer]) << "\n"; } }

Compilation message (stderr)

plan.cpp: In function 'void bfs()':
plan.cpp:13:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |       for(int i = 0 ; i < gr[jet].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...