# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
426840 | 2021-06-14T10:23:44 Z | jamezzz | Trampoline (info1cup20_trampoline) | C++17 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define fi first #define se second #define pb emplace_back #define sz(x) (int)x.size() #define all(x) x.begin(),x.end() typedef pair<int,int> ii; int r,c,n,t,a,b,x1,x2,y1,y2,nx[200005][20]; vector<ii> v,v1,v2; int main(){ sf("%d%d%d",&r,&c,&n); for(int i=0;i<n;++i){ sf("%d%d",&a,&b); v.pb(a,b); } sort(all(v)); for(int i=0;i<n;++i){ if(i!=0&&v[i].fi!=v[i-1].fi){ int cur=0; for(int j=0;j<sz(v2);++j){ while(cur<sz(v1)&&v1[cur].fi<v2[j].fi)++cur; if(cur!=0)nx[v1[cur-1].se][0]=v2[j].se; } v1.clear(); swap(v1,v2); } v2.pb(v[i].se,i); } int cur=0; for(int j=0;j<sz(v2);++j){ while(cur<sz(v1)&&v1[cur].fi<v2[j].fi)++cur; if(cur!=0)nx[v1[cur-1].se][0]=v2[j].se; } /* for(int i=0;i<n;++i){ pf("%d %d: %d\n",v[i].fi,v[i].se,nx[i][0]); } //*/ for(int k=1;k<20;++k){ for(int i=0;i<n;++i){ if(nx[i][k-1]!=-1)nx[i][k]=nx[nx[i][k-1]][k-1]; else nx[i][k]=-1; } } sf("%d",&t); for(int i=0;i<t;++i){ sf("%d%d%d%d",&x1,&y1,&x2,&y2); if(x2<x1||y2<y1){ pf("No\n");continue; } if(x1==x2){ pf("Yes\n");continue; } int x=lower_bound(all(v),ii(x1,y1))-v.begin(); if(x==sz(v)||v[x].fi!=x1){ pf("No\n");continue; } int cur=x; for(int k=19;k>=0;--k){ if(nx[cur][k]!=-1&&v[nx[cur][k]].fi<=x2)cur=nx[cur][k]; } if(v[cur].fi<x2-1||v[cur].se>y2)pf("No\n"); else pf("Yes\n"); } }
Compilation message
trampoline.cpp:13:23: error: 'int y1' redeclared as different kind of entity 13 | int r,c,n,t,a,b,x1,x2,y1,y2,nx[200005][20]; | ^~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518, from /usr/include/c++/10/cassert:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33, from trampoline.cpp:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration 'double y1(double)' 221 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ trampoline.cpp: In function 'int main()': trampoline.cpp:53:10: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'double (*)(double) noexcept' [-Wformat=] 53 | sf("%d%d%d%d",&x1,&y1,&x2,&y2); | ~^ ~~~ | | | | int* double (*)(double) noexcept trampoline.cpp:54:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 54 | if(x2<x1||y2<y1){ | ~~^~~ trampoline.cpp:60:36: error: no matching function for call to 'std::pair<int, int>::pair(int&, double (&)(double) noexcept)' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:452:9: note: candidate: 'template<class ... _Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int ..._Indexes2> std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {_Args1 ...}; long unsigned int ..._Indexes1 = {_Indexes1 ...}; _Args2 = {_Args2 ...}; long unsigned int ..._Indexes2 = {_Indexes2 ...}; _T1 = int; _T2 = int]' 452 | pair(tuple<_Args1...>&, tuple<_Args2...>&, | ^~~~ /usr/include/c++/10/bits/stl_pair.h:452:9: note: template argument deduction/substitution failed: trampoline.cpp:60:36: note: mismatched types 'std::tuple<_Tps ...>' and 'int' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:387:9: note: candidate: 'template<class ... _Args1, class ... _Args2> std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {_Args1 ...}; _Args2 = {_Args2 ...}; _T1 = int; _T2 = int]' 387 | pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); | ^~~~ /usr/include/c++/10/bits/stl_pair.h:387:9: note: template argument deduction/substitution failed: trampoline.cpp:60:36: note: mismatched types 'std::tuple<_Tps ...>' and 'double (*)(double) noexcept' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:381:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 381 | explicit constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:381:21: note: template argument deduction/substitution failed: trampoline.cpp:60:36: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:371:12: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 371 | constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:371:12: note: template argument deduction/substitution failed: trampoline.cpp:60:36: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:361:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 361 | explicit constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:361:21: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:360:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 360 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:352:12: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 352 | constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:352:12: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:351:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 351 | bool>::type=true> | ^~~~ /usr/include/c++/10/bits/stl_pair.h:343:17: note: candidate: 'template<class _U2, typename std::enable_if<_CopyMovePair<false, int, _U2>(), bool>::type <anonymous> > std::pair<_T1, _T2>::pair(const _T1&, _U2&&) [with _U2 = _U2; typename std::enable_if<std::_PCC<true, _T1, _T2>::_CopyMovePair<false, _T1, _U2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 343 | explicit pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:343:17: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:342:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 342 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:336:18: note: candidate: 'template<class _U2, typename std::enable_if<_CopyMovePair<true, int, _U2>(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, _U2&&) [with _U2 = _U2; typename std::enable_if<std::_PCC<true, _T1, _T2>::_CopyMovePair<true, _T1, _U2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 336 | constexpr pair(const _T1& __x, _U2&& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:336:18: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:335:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 335 | bool>::type=true> | ^~~~ /usr/include/c++/10/bits/stl_pair.h:329:27: note: candidate: 'template<class _U1, typename std::enable_if<_MoveCopyPair<false, _U1, int>(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&) [with _U1 = _U1; typename std::enable_if<std::_PCC<true, _T1, _T2>::_MoveCopyPair<false, _U1, _T2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 329 | explicit constexpr pair(_U1&& __x, const _T2& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:329:27: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:328:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 328 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:322:18: note: candidate: 'template<class _U1, typename std::enable_if<_MoveCopyPair<true, _U1, int>(), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, const _T2&) [with _U1 = _U1; typename std::enable_if<std::_PCC<true, _T1, _T2>::_MoveCopyPair<true, _U1, _T2>(), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 322 | constexpr pair(_U1&& __x, const _T2& __y) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:322:18: note: template argument deduction/substitution failed: trampoline.cpp:60:34: note: cannot convert 'y1' (type 'double(double) noexcept') to type 'const int&' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^~ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:315:17: note: candidate: 'constexpr std::pair<_T1, _T2>::pair(std::pair<_T1, _T2>&&) [with _T1 = int; _T2 = int]' 315 | constexpr pair(pair&&) = default; ///< Move constructor | ^~~~ /usr/include/c++/10/bits/stl_pair.h:315:17: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_pair.h:314:17: note: candidate: 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = int; _T2 = int]' 314 | constexpr pair(const pair&) = default; ///< Copy constructor | ^~~~ /usr/include/c++/10/bits/stl_pair.h:314:17: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_pair.h:309:21: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 309 | explicit constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:309:21: note: template argument deduction/substitution failed: trampoline.cpp:60:36: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:300:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 300 | constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:300:19: note: template argument deduction/substitution failed: trampoline.cpp:60:36: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:276:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_ConstructiblePair<_U1, _U2>() && (! _ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 276 | explicit constexpr pair(const _T1& __a, const _T2& __b) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:276:26: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_pair.h:275:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 275 | bool>::type=false> | ^~~~~ /usr/include/c++/10/bits/stl_pair.h:266:17: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_ConstructiblePair<_U1, _U2>() && _ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _U1 = _U1; _U2 = _U2; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 266 | constexpr pair(const _T1& __a, const _T2& __b) | ^~~~ /usr/include/c++/10/bits/stl_pair.h:266:17: note: template argument deduction/substitution failed: trampoline.cpp:60:34: note: cannot convert 'y1' (type 'double(double) noexcept') to type 'const int&' 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^~ 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 trampoline.cpp:1: /usr/include/c++/10/bits/stl_pair.h:245:26: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<std::__and_<std::is_default_constructible<_U1>, std::is_default_constructible<_U2>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair() [with _U1 = _U1; _U2 = _U2; typename std::enable_if<std::__and_<std::is_default_constructible<_U1>, std::is_default_constructible<_U2>, std::__not_<std::__and_<std::__is_implicitly_default_constructible<_U1>, std::__is_implicitly_default_constructible<_U2> > > >::value, bool>::type <anonymous> = <anonymous>; _T1 = int; _T2 = int]' 245 | explicit constexpr pair() | ^~~~ /usr/include/c++/10/bits/stl_pair.h:245:26: note: template argument deduction/substitution failed: trampoline.cpp:60:36: note: candidate expects 0 arguments, 2 provided 60 | int x=lower_bound(all(v),ii(x1,y1))-v.begin(); | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45,