제출 #30039

#제출 시각아이디문제언어결과실행 시간메모리
30039inqr로봇 (IOI13_robots)C++14
컴파일 에러
0 ms0 KiB
#include "robots.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define rt insert #define st first #define nd second #define ll long long #define pii pair < int , int > #define DB printf("debug\n"); using namespace std; int wrc,src,tn; vector < int > wr; vector < int > sr; vector < pii > tws; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { wrc=A;src=B;tn=T; for(int i=0;i<trn;i++){ tws.pb(mp(W[i],S[i])); } sort(tws.begin(),tws.end()); for(int i=0;i<wrc;i++)wr.pb(X[i]); for(int i=0;i<src;i++)sr.pb(Y[i]); sort(wr.begin(),wr.end()); sort(sr.begin(),sr.end());sr.reverse(); int l=0,r=1e9,m,ans=1e9; priority_queue < int > pq; while(l<r){ m=(l+r)/2; pq.clear(); int twsind=0,tswind=0; for(int i=0;i<wrc;i++){// eklicegimiz robotu aldik twsindnx=upper_bound(tws.begin(),tws.end(),wr[i])-tws.begin(); for(int j=twsind;j<twsindnx && j<tn;j++){//eklicemiz robota kalan olan toylari ekledik pq.push(tws[j].nd); } twsind=twsindnx; for(int j=0;j<m && pq.size();i++)pq.pop();// m kadarlari pq dan attik } for(int i=0;i<src;i++){ for(int j=0;j<m;j++){ if(pq.size()){ if(pq.top()<=sr[i]){ pq.pop(); } } } } if(pq.size()){ l=m; ans=min(ans,m); } else{ r=m; } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:18:16: error: 'trn' was not declared in this scope
  for(int i=0;i<trn;i++){
                ^
robots.cpp:25:31: error: 'class std::vector<int>' has no member named 'reverse'
  sort(sr.begin(),sr.end());sr.reverse();
                               ^
robots.cpp:31:6: error: 'class std::priority_queue<int>' has no member named 'clear'
   pq.clear();
      ^
robots.cpp:34:4: error: 'twsindnx' was not declared in this scope
    twsindnx=upper_bound(tws.begin(),tws.end(),wr[i])-tws.begin();
    ^
robots.cpp:32:16: warning: unused variable 'tswind' [-Wunused-variable]
   int twsind=0,tswind=0;
                ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_less_iter::operator()(_Value&, _Iterator) const [with _Value = const int; _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >]':
/usr/include/c++/5/bits/stl_algo.h:2050:14:   required from '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Tp = int; _Compare = __gnu_cxx::__ops::_Val_less_iter]'
/usr/include/c++/5/bits/stl_algo.h:2086:32:   required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Tp = int]'
robots.cpp:34:52:   required from here
/usr/include/c++/5/bits/predefined_ops.h:71:22: error: no match for 'operator<' (operand types are 'const int' and 'std::pair<int, int>')
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/stl_iterator.h:849: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>&)
     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
     ^
/usr/include/c++/5/bits/stl_iterator.h:849:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/stl_iterator.h:856: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>&)
     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^
/usr/include/c++/5/bits/stl_iterator.h:856:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from robots.cpp:2:
/usr/include/c++/5/bits/regex.h:1426: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++/5/bits/regex.h:1426:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from robots.cpp:2:
/usr/include/c++/5/bits/regex.h:1346: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++/5/bits/regex.h:1346:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from robots.cpp:2:
/usr/include/c++/5/bits/regex.h:1269: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++/5/bits/regex.h:1269:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from robots.cpp:2:
/usr/include/c++/5/bits/regex.h:1195: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++/5/bits/regex.h:1195:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from robots.cpp:2:
/usr/include/c++/5/bits/regex.h:1118: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++/5/bits/regex.h:1118:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from robots.cpp:2:
/usr/include/c++/5/bits/regex.h:1038: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++/5/bits/regex.h:1038:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from robots.cpp:2:
/usr/include/c++/5/bits/regex.h:959: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++/5/bits/regex.h:959:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/c++/5/forward_list:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:102,
                 from robots.cpp:2:
/usr/include/c++/5/bits/forward_list.h:1363: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++/5/bits/forward_list.h:1363:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const std::forward_list<_Tp, _Alloc>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94:0,
                 from robots.cpp:2:
/usr/include/c++/5/valarray:1181: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++/5/valarray:1181:1: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>'
       { return __val < *__it; }
                      ^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94:0,
                 from robots.cpp:2:
/usr/include/c++/5/valarray:1181: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++/5/valarray:1181:1: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mismatched types 'const std::valarray<_Tp>' and 'const int'
       { return __val < *__it; }
                      ^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94:0,
                 from robots.cpp:2:
/usr/include/c++/5/valarray:1181: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++/5/valarray:1181:1: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from robots.cpp:2:
/usr/include/c++/5/bits/predefined_ops.h:71:22: note:   mi