Submission #311863

#TimeUsernameProblemLanguageResultExecution timeMemory
311863arnold518Bitaro’s Party (JOI18_bitaro)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2e5; const int SQ = 200; const int INF = 1e9; int N, M, Q; vector<int> adj[MAXN+10]; int ans[MAXN+10]; int dp[MAXN+10]; struct Data { int T, P; vector<int> V; }; Data A[MAXN+10]; vector<int> P[MAXN+10]; vector<pii> dp2[MAXN+10]; bool chk[MAXN+10]; int main() { memset(ans, -1, sizeof(ans)); scanf("%d%d%d", &N, &M, &Q); for(int i=1; i<=M; i++) { int u, v; scanf("%d%d", &u, &v); adj[v].push_back(u); } for(int i=1; i<=Q; i++) { int a, b; scanf("%d%d", &a, &b); A[i].T=a; A[i].P=i; while(b--) { int t; scanf("%d", &t); A[i].V.push_back(t); } if(A[i].V.size()>=SQ) { for(int j=1; j<=N; j++) dp[j]=0; for(auto it : A[i].V) dp[it]=-INF; for(int j=1; j<=N; j++) for(auto nxt : adj[j]) dp[j]=max(dp[j], dp[nxt]+1); if(dp[A[i].T]>=0) ans[i]=dp[A[i].T]; } else P[A[i].T].push_back(i); } for(int now=1; now<=N; now++) { dp2[now].push_back({0, now}); for(auto nxt : adj[now]) { for(auto it : dp2[nxt]) { dp2[now].push_back({it.first+1, it.second}); } } sort(dp2[now].begin(), dp2[now].end(), greater<pii>()); while(dp2[now].size()>SQ) dp2[now].pop_back(); for(auto it : P[now]) { assert(dp2[now].size()>A[it].V].size()); for(auto pt : A[it].V) chk[pt]=true; for(auto jt : dp2[now]) { if(!chk[jt.second]) { ans[it]=jt.first; break; } } for(auto pt : A[it].V) chk[pt]=false; } } for(int i=1; i<=Q; i++) printf("%d\n", ans[i]); }

Compilation message (stderr)

In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp: In function 'int main()':
bitaro.cpp:75:26: error: no match for 'operator>' (operand types are 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'std::vector<int>')
   75 |    assert(dp2[now].size()>A[it].V].size());
      |           ~~~~~~~~~~~~~~~^~~~~~~~
      |                        |        |
      |                        |        std::vector<int>
      |                        std::vector<std::pair<int, int> >::size_type {aka long unsigned int}
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/regex.h:1081:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)'
 1081 |     operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1081:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/regex.h:1136: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>&)'
 1136 |     operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1136:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/regex.h:1210: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>&)'
 1210 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1210:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/regex.h:1284: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>&)'
 1284 |     operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1284:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/regex.h:1358: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*)'
 1358 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1358:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/regex.h:1434: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>&)'
 1434 |     operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1434:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/regex.h:1512: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&)'
 1512 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1512:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/stl_pair.h:467:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  467 |     operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_pair.h:467:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::pair<_T1, _T2>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:343:5: note: candidate: 'template<class _Iterator> bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  343 |     operator>(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:343:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:381:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  381 |     operator>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:381:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:1187:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1187 |     operator>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1187:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/char_traits.h:39,
                 from /usr/include/c++/9/ios:40,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:1193:5: note: candidate: 'template<class _Iterator> bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1193 |     operator>(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1193:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6264:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6264 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6264:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6277:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 6277 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6277:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6289:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6289 |     operator>(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6289:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from bitaro.cpp:1:
bitaro.cpp:75:33: note:   mismatched types 'const _CharT*' and 'long unsigned int'
   75 |    assert(dp2[now].size()>A[it].V].size());
      |                                 ^
In file included from /usr/include/c++/9/deque:67,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:68,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/stl_deque.h:327:5: note: candidate: 'template<class _Tp, class _Ref, class _Ptr> bool std::operator>(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&)'
  327 |     operator>(const _Deque_iterat