Submission #984771

#TimeUsernameProblemLanguageResultExecution timeMemory
984771RafiullahCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; #define int long long 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) { map<int,vector<int>> graph; map<pair<int,int>,int> weight; for(int i = 0 ;i <x.size() ;i ++){ int a = x[i]; int b = y[i]; int cc = c[i]; weight[{min(a,b),max(a,b)}] = cc; graph[a].push_back(b); graph[b].push_back(a); } int dist[N]; for(int i = 1 ;i <N ;i ++)dist[i] = 1e15; dist[0] = 0; priority_queue<pair<int,int>> pq; pq.push({0,0}); while(pq.size()>0){ int node = pq.top().second; pq.pop(); for(int child:graph[node]){ int W = dist[node] + weight[{min(child,node),max(child,node)}]; if(arr[child] == 0){ W = 0; } if(W<dist[child]){ dist[child] = W; pq.push({-dist[child],child}); } } } if(dist[H] == 1e15)dist[H] = -1; return dist[H]; }

Compilation message (stderr)

cyberland.cpp: In function 'double solve(long long int, long long int, long long int, long long int, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
cyberland.cpp:9:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 0 ;i <x.size() ;i ++){
      |                    ~~^~~~~~~~~
/usr/bin/ld: /tmp/cclpCNMr.o: in function `main':
grader.cpp:(.text.startup+0x696): undefined reference to `solve(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status