Submission #881092

#TimeUsernameProblemLanguageResultExecution timeMemory
881092HoriaHaivasTrampoline (info1cup20_trampoline)C++14
Compilation error
0 ms0 KiB
/* "care a facut teste cu Lattice reduction attack e ciudat" "linistiti va putin" - 2023 - */ #include<bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " #pragma GCC optimize("Ofast") using namespace std; struct trambuline_dorian_popa { int indice; int l; int c; int lnorm; }; bool cmp(trambuline_dorian_popa a, trambuline_dorian_popa b) { return a.l<b.l; } bool cmp2(trambuline_dorian_popa a, trambuline_dorian_popa b) { return a.c<b.c; } trambuline_dorian_popa v[200001]; int up[18][200001]; vector<trambuline_dorian_popa> nivel[200001]; unordered_map<int,int> mp; unordered_map<int,int> mp2; int main() { ifstream fin("secvp.in"); ofstream fout("secvp.out"); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,t,i,j,row,col,x,r,pas,x1,y1,x2,y2; cin >> row >> col >> n; for (j=1; j<=n; j++) { cin >> v[j].l >> v[j].c; v[j].indice=j; } sort(v+1,v+1+n,cmp); x=0; for (j=1; j<=n; j++) { if (j==1 || v[j].l!=v[j-1].l) { if (x!=0) sort(nivel[x].begin(),nivel[x].end(),cmp2); x++; } v[j].lnorm=x; nivel[x].push_back(v[j]); mp[x]=v[j].l; mp2[v[j].l]=x; } sort(nivel[x].begin(),nivel[x].end(),cmp2); for (j=1; j<=n; j++) { if (mp2[v[j].l+1]==v[j].lnorm+1) { r=-1; pas=(1<<17); while (pas) { if (r+pas<nivel[v[j].lnorm+1].size() && v[j].c>nivel[v[j].lnorm+1][r+pas].c) r+=pas; pas=pas/2; } r++; if (r==nivel[v[j].lnorm+1].size()) up[0][j]=j; else up[0][j]=nivel[v[j].lnorm+1][r].indice; } else { up[0][j]=j; } } for (j=1; j<=17; j++) { for (i=1; i<=n; i++) { up[j][i]=up[j-1][up[j-1][i]]; } } cin >> t; for (j=1; j<=t; j++) { cin >> x1 >> y1 >> x2 >> y2; if (x1==x2 && y1<=y2) { cout << "Yes\n"; continue; } if (x1>x2 || y1>y2) { cout << "No\n"; continue; } if (mp2[x1]!=0) { r=-1; pas=(1<<17); while(pas) { if (r+pas<nivel[mp2[x1]].size() && y1>nivel[mp2[x1]][r+pas].c) r+=pas; pas=pas/2; } r++; if (!(is_sorted(nivel[mp2[x1]].begin(),nivel[mp2[x1]].end()))) exit(1); if (r==nivel[mp2[x1]].size()) { if (x1==x2 && y1<=y2) { cout << "Yes\n"; continue; } else { cout << "No\n"; continue; } } else { i=nivel[mp2[x1]][r].indice; pas=17; while(pas) { if (v[up[pas][i]].l+1<=x2) i=up[pas][i]; pas--; } if (v[i].l+1==x2 && v[i].c<=y2) { cout << "Yes\n"; continue; } else { cout << "No\n"; continue; } } } else { if (x1==x2 && y1<=y2) { cout << "Yes\n"; continue; } else { cout << "No\n"; continue; } } } }

Compilation message (stderr)

trampoline.cpp: In function 'int main()':
trampoline.cpp:75:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<trambuline_dorian_popa>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |                 if (r+pas<nivel[v[j].lnorm+1].size() && v[j].c>nivel[v[j].lnorm+1][r+pas].c)
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:80:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<trambuline_dorian_popa>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |             if (r==nivel[v[j].lnorm+1].size())
      |                 ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:117:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<trambuline_dorian_popa>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  117 |                 if (r+pas<nivel[mp2[x1]].size() && y1>nivel[mp2[x1]][r+pas].c)
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:124:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<trambuline_dorian_popa>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  124 |             if (r==nivel[mp2[x1]].size())
      |                 ~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from trampoline.cpp:6:
/usr/include/c++/10/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<trambuline_dorian_popa*, std::vector<trambuline_dorian_popa> >; _Iterator2 = __gnu_cxx::__normal_iterator<trambuline_dorian_popa*, std::vector<trambuline_dorian_popa> >]':
/usr/include/c++/10/bits/stl_algo.h:3253:12:   required from '_ForwardIterator std::__is_sorted_until(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<trambuline_dorian_popa*, std::vector<trambuline_dorian_popa> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/10/bits/stl_algo.h:3278:36:   required from '_FIter std::is_sorted_until(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<trambuline_dorian_popa*, std::vector<trambuline_dorian_popa> >]'
/usr/include/c++/10/bits/stl_algo.h:3224:34:   required from 'bool std::is_sorted(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<trambuline_dorian_popa*, std::vector<trambuline_dorian_popa> >]'
trampoline.cpp:122:72:   required from here
/usr/include/c++/10/bits/predefined_ops.h:43:23: error: no match for 'operator<' (operand types are 'trambuline_dorian_popa' and 'trambuline_dorian_popa')
   43 |       { return *__it1 < *__it2; }
      |                ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from trampoline.cpp:6:
/usr/include/c++/10/bits/stl_iterator.h:1096:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
 1096 |     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1096:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from trampoline.cpp:6:
/usr/include/c++/10/bits/predefined_ops.h:43:23: note:   'trambuline_dorian_popa' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
   43 |       { return *__it1 < *__it2; }
      |                ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from trampoline.cpp:6:
/usr/include/c++/10/bits/stl_iterator.h:1104:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1104 |     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1104:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from trampoline.cpp:6:
/usr/include/c++/10/bits/predefined_ops.h:43:23: note:   'trambuline_dorian_popa' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
   43 |       { return *__it1 < *__it2; }
      |                ~~~~~~~^~~~~~~~