# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976535 | marinaluca | Crocodile's Underground City (IOI11_crocodile) | C++14 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
int travel_plan(int N, int M, int R[][2], int L[], int k, int P[]){
vector <vector<pair<int, int>>> ans(N);
for (int i = 0; i < M; ++ i){
int a = r[i][0], b = r[i][1];
ans[a].emplace_back(b, L[i]);
ans[b].emplace_back(a, L[i]);
}
vector <int> v(N);
priority_queue<pair<int, int>> pq(N);
for (int i = 0; i < k; ++ i){
v[P[i]] ++;
pq.emplace(0, P[i]);
}
while (!pq.empty()){
auto [x, y] = pq.top();
pq.pop();
if (v[y] ++ == 1){
if (y == 0)
return -x;
for (auto &[xx, yy] : ans[y]){
pq.emplace(x - yy, xx);
}
}
}
}
Compilation message (stderr)
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)': crocodile.cpp:8:17: error: 'r' was not declared in this scope 8 | int a = r[i][0], b = r[i][1]; | ^ crocodile.cpp:9:29: error: 'b' was not declared in this scope 9 | ans[a].emplace_back(b, L[i]); | ^ crocodile.cpp:13:40: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::priority_queue(int&)' 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:597:2: note: candidate: 'template<class _InputIterator> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&) [with _InputIterator = _InputIterator; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 597 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:597:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 4 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:586:2: note: candidate: 'template<class _InputIterator> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&) [with _InputIterator = _InputIterator; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 586 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:586:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 4 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:554:2: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>&&, const _Alloc&) [with _Alloc = _Alloc; _Requires = _Requires; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 554 | priority_queue(priority_queue&& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:554:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 2 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:550:2: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const std::priority_queue<_Tp, _Sequence, _Compare>&, const _Alloc&) [with _Alloc = _Alloc; _Requires = _Requires; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 550 | priority_queue(const priority_queue& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:550:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 2 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:545:2: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&, const _Alloc&) [with _Alloc = _Alloc; _Requires = _Requires; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 545 | priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:545:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 3 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:539:2: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&, const _Alloc&) [with _Alloc = _Alloc; _Requires = _Requires; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 539 | priority_queue(const _Compare& __x, const _Sequence& __c, | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:539:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 3 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:533:2: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Alloc&) [with _Alloc = _Alloc; _Requires = _Requires; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 533 | priority_queue(const _Compare& __x, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:533:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 2 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:529:2: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Alloc&) [with _Alloc = _Alloc; _Requires = _Requires; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 529 | priority_queue(const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:529:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_queue.h: In substitution of 'template<class _Tp, class _Sequence, class _Compare> template<class _Alloc> using _Uses = typename std::enable_if<std::uses_allocator<_Sequence, _Alloc>::value>::type [with _Alloc = int; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]': /usr/include/c++/10/bits/stl_queue.h:527:33: required from here /usr/include/c++/10/bits/stl_queue.h:473:8: error: no type named 'type' in 'struct std::enable_if<false, void>' 473 | using _Uses = typename | ^~~~~ /usr/include/c++/10/bits/stl_queue.h:523:7: note: candidate: 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 523 | priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:523:38: note: no known conversion for argument 1 from 'int' to 'const std::less<std::pair<int, int> >&' 523 | priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_queue.h:518:7: note: candidate: 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 518 | priority_queue(const _Compare& __x, const _Sequence& __s) | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:518:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/stl_queue.h:514:2: note: candidate: 'template<class _Seq, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue() [with _Seq = _Seq; _Requires = _Requires; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >]' 514 | priority_queue() | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:514:2: note: template argument deduction/substitution failed: crocodile.cpp:13:40: note: candidate expects 0 arguments, 1 provided 13 | priority_queue<pair<int, int>> pq(N); | ^ In file included from /usr/include/c++/10/queue:64, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86, from crocodile.cpp:1: /usr/include/c++/10/bits/stl_queue.h:456:11: note: candidate: 'std::priority_queue<std::pair<int, int> >::priority_queue(const std::priority_queue<std::pair<int, int> >&)' 456 | class priority_queue | ^~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_queue.h:456:11: note: no known conversion for argument 1 from 'int' to 'const std::priority_queue<std::pair<int, int> >&' /usr/include/c++/10/bits/stl_queue.h:456:11: note: candidate: 'std::priority_queue<std::pair<int, int> >::priority_queue(std::priority_queue<std::pair<int, int> >&&)' /usr/include/c++/10/bits/stl_queue.h:456:11: note: no known conversion for argument 1 from 'int' to 'std::priority_queue<std::pair<int, int> >&&' crocodile.cpp:19:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' 19 | auto [x, y] = pq.top(); | ^ crocodile.cpp:24:24: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' 24 | for (auto &[xx, yy] : ans[y]){ | ^ crocodile.cpp:6:42: warning: control reaches end of non-void function [-Wreturn-type] 6 | vector <vector<pair<int, int>>> ans(N); | ^