# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244648 | uacoder123 | Jakarta Skyscrapers (APIO15_skyscraper) | 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>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
typedef int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;
vector<ii> al[6*1000000];
lli dis[6000000];
set<ii> s;
lli dij(lli so,lli t)
{
for(lli i=0;i<6000000;++i)
dis[i]=1000000000;
s.insert(mp(0,so));
dis[so]=0;
while(s.size()!=0)
{
ii v=(*s.begin());
s.erase(s.begin());
dis[v.S]=v.F;
for(lli i=0;i<al[v.S].size();++i)
{
if(al[v.S][i].S+v.F<dis[al[v.S][i].F])
{
s.erase(mp(dis[al[v.S][i].F],al[v.S][i].F));
dis[al[v.S][i].F]=al[v.S][i].S+v.F;
s.insert(mp(dis[al[v.S][i].F],al[v.S][i].F));
}
}
}
if(dis[t]==1000000000)
return(-1);
return(dis[t]);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli test=1;
for(;test>0;--test)
{
lli n,m,rn;
cin>>n>>m;
rn=sqrt(n)+1;
ii dg[m];
for(lli i=1;i<rn;++i)
{
for(lli j=0;j<n;++j)
{
if(j+i<n)
{
al[i*n+j].pb(mp(i*n+j+i,1));
al[i*n+j+i].pb(mp(i*n+j,1));
}
if(j+i<n)
al[i*n+j].pb(mp(rn*n+j+i,1));
if(j-i>=0)
al[i*n+j].pb(mp(rn*n+j-i,1));
}
}
for(lli i=0;i<m;++i)
{
lli f,se;
cin>>f>>se;
dg[i]=mp(f,se);
if(s<rn)
{
al[rn*n+f].pb(mp((se)*n+f,0));
al[se*n+f].pb(mp(rn*n+f,0));
}
if(se>=rn)
{
lli p=f+se;
while(p<n)
{
al[rn*n+f].pb(mp(rn*n+p,(p-f)/se));
p+=se;
}
p=f-se;
while(p>=0)
{
al[rn*n+f].pb(mp(rn*n+p,(f-p)/se));
p-=se;
}
}
}
cout<<dij(dg[0].S*n+dg[0].F,dg[1].S*n+dg[1].F)<<endl;
}
return(0);
}
Compilation message (stderr)
skyscraper.cpp: In function 'lli dij(lli, lli)': skyscraper.cpp:31:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(lli i=0;i<al[v.S].size();++i) ~^~~~~~~~~~~~~~~ skyscraper.cpp: In function 'int main()': skyscraper.cpp:76:11: error: no match for 'operator<' (operand types are 'std::set<std::pair<int, int> >' and 'lli {aka int}') if(s<rn) ~^~~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from skyscraper.cpp:1: /usr/include/c++/7/bits/regex.h:962:5: note: candidate: template<class _BiIter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&) operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) ^~~~~~~~ /usr/include/c++/7/bits/regex.h:962:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(s<rn) ^~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from skyscraper.cpp:1: /usr/include/c++/7/bits/regex.h:1041:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&) operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1041:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' if(s<rn) ^~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from skyscraper.cpp:1: /usr/include/c++/7/bits/regex.h:1121:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&) operator<(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1121:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(s<rn) ^~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from skyscraper.cpp:1: /usr/include/c++/7/bits/regex.h:1198:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&) operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1198:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'lli {aka int}' if(s<rn) ^~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from skyscraper.cpp:1: /usr/include/c++/7/bits/regex.h:1272:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*) operator<(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1272:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(s<rn) ^~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from skyscraper.cpp:1: /usr/include/c++/7/bits/regex.h:1349:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&) operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1349:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'lli {aka int}' if(s<rn) ^~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from skyscraper.cpp:1: /usr/include/c++/7/bits/regex.h:1429:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&) operator<(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1429:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(s<rn) ^~ In file included from /usr/include/c++/7/future:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105, from skyscraper.cpp:1: /usr/include/c++/7/thread:281:3: note: candidate: bool std::operator<(std::thread::id, std::thread::id) operator<(thread::id __x, thread::id __y) noexcept ^~~~~~~~ /usr/include/c++/7/thread:281:3: note: no known conversion for argument 1 from 'std::set<std::pair<int, int> >' to 'std::thread::id' In file included from /usr/include/c++/7/forward_list:38:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:104, from skyscraper.cpp:1: /usr/include/c++/7/bits/forward_list.h:1391:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator<(const std::forward_list<_Tp, _Alloc>&, const std::forward_list<_Tp, _Alloc>&) operator<(const forward_list<_Tp, _Alloc>& __lx, ^~~~~~~~ /usr/include/c++/7/bits/forward_list.h:1391:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::forward_list<_Tp, _Alloc>' if(s<rn) ^~ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from skyscraper.cpp:1: /usr/include/c++/7/valarray:1186:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__less, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__less, _Tp>::result_type> std::operator<(const _Tp&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/valarray:1186:1: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: mismatched types 'const std::valarray<_Tp>' and 'lli {aka int}' if(s<rn) ^~ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from skyscraper.cpp:1: /usr/include/c++/7/valarray:1186:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__less, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__less, _Tp>::result_type> std::operator<(const std::valarray<_Tp>&, const _Tp&) _DEFINE_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/valarray:1186:1: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::valarray<_Tp>' if(s<rn) ^~ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from skyscraper.cpp:1: /usr/include/c++/7/valarray:1186:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__less, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__less, _Tp>::result_type> std::operator<(const std::valarray<_Tp>&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/valarray:1186:1: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::valarray<_Tp>' if(s<rn) ^~ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from skyscraper.cpp:1: /usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__less, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/bits/valarray_after.h:416:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'lli {aka int}' if(s<rn) ^~ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from skyscraper.cpp:1: /usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__less, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/bits/valarray_after.h:416:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if(s<rn) ^~ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from skyscraper.cpp:1: /usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__less, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/bits/valarray_after.h:416:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'lli {aka int}' if(s<rn) ^~ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from skyscraper.cpp:1: /usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__less, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&) _DEFINE_EXPR_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/bits/valarray_after.h:416:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if(s<rn) ^~ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from skyscraper.cpp:1: /usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__less, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(<, __less) ^ /usr/include/c++/7/bits/valarray_after.h:416:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' if(s<rn) ^~ In file included from /usr/include/c++/7/stack:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:89, from skyscraper.cpp:1: /usr/include/c++/7/bits/stl_stack.h:311:5: note: candidate: template<class _Tp, class _Seq> bool std::operator<(const std::stack<_Tp, _Seq>&, const std::stack<_Tp, _Seq>&) operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_stack.h:311:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::stack<_Tp, _Seq>' if(s<rn) ^~ In file included from /usr/include/c++/7/set:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from skyscraper.cpp:1: /usr/include/c++/7/bits/stl_multiset.h:913:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator<(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&) operator<(const multiset<_Key, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_multiset.h:913:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::multiset<_Key, _Compare, _Alloc>' if(s<rn) ^~ In file included from /usr/include/c++/7/set:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from skyscraper.cpp:1: /usr/include/c++/7/bits/stl_set.h:930:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator<(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&) operator<(const set<_Key, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_set.h:930:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: mismatched types 'const std::set<_Key, _Compare, _Alloc>' and 'lli {aka int}' if(s<rn) ^~ In file included from /usr/include/c++/7/queue:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from skyscraper.cpp:1: /usr/include/c++/7/bits/stl_queue.h:336:5: note: candidate: template<class _Tp, class _Seq> bool std::operator<(const std::queue<_Tp, _Seq>&, const std::queue<_Tp, _Seq>&) operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_queue.h:336:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::queue<_Tp, _Seq>' if(s<rn) ^~ In file included from /usr/include/c++/7/vector:64:0, from /usr/include/c++/7/queue:61, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86, from skyscraper.cpp:1: /usr/include/c++/7/bits/stl_vector.h:1613:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator<(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:1613:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::vector<_Tp, _Alloc>' if(s<rn) ^~ In file included from /usr/include/c++/7/memory:81:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from skyscraper.cpp:1: /usr/include/c++/7/bits/shared_ptr.h:416:5: note: candidate: template<class _Tp> bool std::operator<(std::nullptr_t, const std::shared_ptr<_Tp>&) operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept ^~~~~~~~ /usr/include/c++/7/bits/shared_ptr.h:416:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: mismatched types 'const std::shared_ptr<_Tp>' and 'lli {aka int}' if(s<rn) ^~ In file included from /usr/include/c++/7/memory:81:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from skyscraper.cpp:1: /usr/include/c++/7/bits/shared_ptr.h:408:5: note: candidate: template<class _Tp> bool std::operator<(const std::shared_ptr<_Tp>&, std::nullptr_t) operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept ^~~~~~~~ /usr/include/c++/7/bits/shared_ptr.h:408:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::shared_ptr<_Tp>' if(s<rn) ^~ In file included from /usr/include/c++/7/memory:81:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from skyscraper.cpp:1: /usr/include/c++/7/bits/shared_ptr.h:398:5: note: candidate: template<class _Tp, class _Up> bool std::operator<(const std::shared_ptr<_Tp>&, const std::shared_ptr<_Up>&) operator<(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept ^~~~~~~~ /usr/include/c++/7/bits/shared_ptr.h:398:5: note: template argument deduction/substitution failed: skyscraper.cpp:76:12: note: 'std::set<std::pair<int, int> >' is not derived from 'const std::shared_ptr<_Tp>' if(s<rn) ^~ In file included from /usr/include/c++/7/bits/shared_ptr.h:52:0, from /usr/include/c++/7/memory:81, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:82, from skyscraper.cpp:1: /usr/include/c++/7/bits/shared_ptr_base.h:1460:5: note: candidate: template<class _Tp, _