# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917585 | hariaakas646 | Rainforest Jumps (APIO21_jumps) | 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 "jumps.h"
#include <bits/stdc++.h>
using namespace std;
#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, l, r) for(int i=l; i<r; i++)
#define frange(i, l) forr(i, 0, l)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef long long lli;
typedef vector<vi> vvi;
typedef vector<lli> vll;
typedef vector<bool> vb;
typedef set<int> seti;
typedef multiset<int> mseti;
vvi graph;
int n;
void init(int N, std::vector<int> h) {
n = N;
graph = vvi(n);
seti st1, st2;
frange(i, n) st2.insert(mp(h[i], i));
frange(i, n) {
st2.erase(mp(h[i], i));
auto it = st1.lower_bound(mp(h[i]+1, 0));
if(it != st.end())
graph[i].pb((*it).s);
it = st2.lower_bound(mp(h[i]+1, 0));
if(it != st.end()) {
graph[i].pb((*it).s);
}
st1.insert(mp(h[i], i));
}
}
int minimum_jumps(int A, int B, int C, int D) {
queue<pii> q;
forr(i, A, B+1) q.push(mp(i, 0));
vb vis(n)
while(q.size()) {
auto p = q.front();
q.pop();
if(C <= p.f && p.f <= D) return p.s;
if(vis[p.f]) continue;
vis[p.f] = true;
for(auto e : graph[x]) {
q.push(mp(e, p.s+1));
}
}
return -1;
}
Compilation message (stderr)
jumps.cpp: In function 'void init(int, std::vector<int>)': jumps.cpp:34:38: error: no matching function for call to 'std::set<int>::insert(std::pair<int, int>)' 34 | frange(i, n) st2.insert(mp(h[i], i)); | ^ In file included from /usr/include/c++/10/set:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from jumps.cpp:2: /usr/include/c++/10/bits/stl_set.h:509:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = int]' 509 | insert(const value_type& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_set.h:509:32: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const value_type&' {aka 'const int&'} 509 | insert(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_set.h:518:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = int]' 518 | insert(value_type&& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_set.h:518:27: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::set<int>::value_type&&' {aka 'int&&'} 518 | insert(value_type&& __x) | ~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_set.h:546:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = int]' 546 | insert(const_iterator __position, const value_type& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_set.h:546:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/stl_set.h:551:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = int]' 551 | insert(const_iterator __position, value_type&& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_set.h:551:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/stl_set.h:566:2: note: candidate: 'template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 566 | insert(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/10/bits/stl_set.h:566:2: note: template argument deduction/substitution failed: jumps.cpp:34:38: note: candidate expects 2 arguments, 1 provided 34 | frange(i, n) st2.insert(mp(h[i], i)); | ^ In file included from /usr/include/c++/10/set:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from jumps.cpp:2: /usr/include/c++/10/bits/stl_set.h:578:7: note: candidate: 'void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 578 | insert(initializer_list<value_type> __l) | ^~~~~~ /usr/include/c++/10/bits/stl_set.h:578:43: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::initializer_list<int>' 578 | insert(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ jumps.cpp:37:26: error: no matching function for call to 'std::set<int>::erase(std::pair<int, int>)' 37 | st2.erase(mp(h[i], i)); | ^ In file included from /usr/include/c++/10/set:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from jumps.cpp:2: /usr/include/c++/10/bits/stl_set.h:654:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator]' 654 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/10/bits/stl_set.h:654:28: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::set<int>::const_iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} 654 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:684:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::size_type = long unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = int]' 684 | erase(const key_type& __x) | ^~~~~ /usr/include/c++/10/bits/stl_set.h:684:29: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const key_type&' {aka 'const int&'} 684 | erase(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_set.h:706:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator]' 706 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/10/bits/stl_set.h:706:7: note: candidate expects 2 arguments, 1 provided jumps.cpp:38:44: error: no matching function for call to 'std::set<int>::lower_bound(std::pair<int, int>)' 38 | auto it = st1.lower_bound(mp(h[i]+1, 0)); | ^ In file included from /usr/include/c++/10/set:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from jumps.cpp:2: /usr/include/c++/10/bits/stl_set.h:829:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]' 829 | lower_bound(const key_type& __x) | ^~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:829:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const key_type&' {aka 'const int&'} 829 | lower_bound(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_set.h:833:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]' 833 | lower_bound(const key_type& __x) const | ^~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:833:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const key_type&' {aka 'const int&'} 833 | lower_bound(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_set.h:839:2: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_lower_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::lower_bound(const _Kt&) [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 839 | lower_bound(const _Kt& __x) | ^~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:839:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_lower_bound_tr(__x))) std::set<int>::lower_bound<_Kt>(const _Kt&) [with _Kt = std::pair<int, int>]': jumps.cpp:38:44: required from here /usr/include/c++/10/bits/stl_set.h:840:45: error: no matching function for call to 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_lower_bound_tr(const std::pair<int, int>&)' 840 | -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/10/map:60, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from jumps.cpp:2: /usr/include/c++/10/bits/stl_tree.h:1330:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_lower_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 1330 | _M_lower_bound_tr(const _Kt& __k) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1330:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_tree.h: In substitution of 'template<class _Cmp, class _SfinaeType> using __has_is_transparent_t = typename std::__has_is_transparent<_Cmp, _SfinaeType>::type [with _Cmp = std::less<int>; _SfinaeType = std::pair<int, int>]': /usr/include/c++/10/bits/stl_tree.h:1328:9: required by substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_lower_bound_tr(__x))) std::set<int>::lower_bound<_Kt>(const _Kt&) [with _Kt = std::pair<int, int>]' jumps.cpp:38:44: required from here /usr/include/c++/10/bits/stl_tree.h:429:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<int>, std::pair<int, int>, void>' 429 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_lower_bound_tr(__x))) std::set<int>::lower_bound<_Kt>(const _Kt&) [with _Kt = std::pair<int, int>]': jumps.cpp:38:44: required from here /usr/include/c++/10/bits/stl_tree.h:1339:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_lower_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 1339 | _M_lower_bound_tr(const _Kt& __k) const | ^~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1339:2: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/set:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from jumps.cpp:2: /usr/include/c++/10/bits/stl_set.h:845:2: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::const_iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_lower_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::lower_bound(const _Kt&) const [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 845 | lower_bound(const _Kt& __x) const | ^~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:845:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::const_iterator)(((const std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_lower_bound_tr(__x))) std::set<int>::lower_bound<_Kt>(const _Kt&) const [with _Kt = std::pair<int, int>]': jumps.cpp:38:44: required from here /usr/include/c++/10/bits/stl_set.h:846:51: error: no matching function for call to 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_lower_bound_tr(const std::pair<int, int>&) const' 846 | -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/10/map:60, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from jumps.cpp:2: /usr/include/c++/10/bits/stl_tree.h:1330:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_lower_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 1330 | _M_lower_bound_tr(const _Kt& __k) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1330:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_tree.h:1339:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_lower_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 1339 | _M_lower_bound_tr(const _Kt& __k) const | ^~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1339:2: note: template argument deduction/substitution failed: jumps.cpp:39:14: error: 'st' was not declared in this scope; did you mean 'st2'? 39 | if(it != st.end()) | ^~ | st2 jumps.cpp:41:39: error: no matching function for call to 'std::set<int>::lower_bound(std::pair<int, int>)' 41 | it = st2.lower_bound(mp(h[i]+1, 0)); | ^ In file included from /usr/include/c++/10/set:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from jumps.cpp:2: /usr/include/c++/10/bits/stl_set.h:829:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]' 829 | lower_bound(const key_type& __x) | ^~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:829:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const key_type&' {aka 'const int&'} 829 | lower_bound(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_set.h:833:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]' 833 | lower_bound(const key_type& __x) const | ^~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:833:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const key_type&' {aka 'const int&'} 833 | lower_bound(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_set.h:839:2: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_lower_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::lower_bound(const _Kt&) [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]' 839 | lower_bound(const _Kt& __x) | ^~~~~~~~~~~ /usr/include/c++/10/bits/stl_set.h:839:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)