Submission #967053

#TimeUsernameProblemLanguageResultExecution timeMemory
967053akacool445kCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" using namespace std; // #define long long long long #define ff first #define ss second const int shrek = 1e5; vector< vector<pair<double, double>>> adj(shrek); double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { vector<double> dist (n + 1); for(int i = 0; i < n; i++) dist[i] = -1; for(int i = 0; i < m; i++) { adj[x[i]].push_back({y[i], c[i]}); adj[y[i]].push_back({x[i], c[i]}); } priority_queue <pair<double >> q; q.push({0, 0}); while(!q.empty()) { pair<double, double> p = q.top(); q.pop(); if(dist[p.ss] != -1) continue; dist[p.ss] = -p.ff; for(auto x : adj[p.ss]) { q.push({p.ff - x.ss, x.ff}); } } 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:17:26: error: wrong number of template arguments (1, should be 2)
   17 |     priority_queue <pair<double >> q;
      |                          ^~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
  211 |     struct pair
      |            ^~~~
cyberland.cpp:17:33: error: template argument 1 is invalid
   17 |     priority_queue <pair<double >> q;
      |                                 ^~
cyberland.cpp:17:33: error: template argument 2 is invalid
cyberland.cpp:17:33: error: template argument 3 is invalid
cyberland.cpp:18:7: error: request for member 'push' in 'q', which is of non-class type 'int'
   18 |     q.push({0, 0});
      |       ^~~~
cyberland.cpp:19:14: error: request for member 'empty' in 'q', which is of non-class type 'int'
   19 |     while(!q.empty()) {
      |              ^~~~~
cyberland.cpp:20:36: error: request for member 'top' in 'q', which is of non-class type 'int'
   20 |         pair<double, double> p = q.top();
      |                                    ^~~
cyberland.cpp:21:11: error: request for member 'pop' in 'q', which is of non-class type 'int'
   21 |         q.pop();
      |           ^~~
cyberland.cpp:25:15: error: request for member 'push' in 'q', which is of non-class type 'int'
   25 |             q.push({p.ff - x.ss, x.ff});
      |               ^~~~