Submission #1059106

#TimeUsernameProblemLanguageResultExecution timeMemory
1059106vjudge1Cyberland (APIO23_cyberland)C++17
15 / 100
135 ms8248 KiB
#include <bits/stdc++.h> using namespace std; long long dist[100001]; void dijkstra(vector<pair<long long,long long>> adj[],long long i) { priority_queue<pair<long long,long long>> pq; pq.push({-0,i}); dist[i]=0; while(pq.size()>0) { long long a=-pq.top().first,b=pq.top().second; pq.pop(); for(auto it : adj[b]) { if(dist[it.first]==-1 || (dist[it.first]>a+it.second)) { dist[it.first]=dist[b]+it.second; pq.push({-dist[it.first],it.first}); } } } } 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) { memset(dist,-1,sizeof(dist)); vector<pair<long long,long long>> adj[N+1]; for(long long i=0;i<x.size();i++) { long long a=x[i],b=y[i],cc=c[i]; adj[a].push_back({b,cc}); adj[b].push_back({a,cc}); } dijkstra(adj,0); return dist[H]; }

Compilation message (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:34:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(long long i=0;i<x.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...