/ Vijos /

记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:36:15: error: 'i' was not declared in this scope
     int ans=p[i].n;//用于输出的答案
               ^
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/7/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = peanuts*; _Iterator2 = peanuts*; _Compare = std::greater<int>]':
/usr/include/c++/7/bits/stl_algo.h:1847:14:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1885:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1971:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:4868:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = peanuts*; _Compare = std::greater<int>]'
/in/foo.cc:30:136:   required from here
/usr/include/c++/7/bits/predefined_ops.h:143:18: error: no match for call to '(std::greater<int>) (peanuts&, peanuts&)'
         { return bool(_M_comp(*__it1, *__it2)); }
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/string:48:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/7/bits/stl_function.h:375:7: note: candidate: bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = int]
       operator()(const _Tp& __x, const _Tp& __y) const
       ^~~~~~~~
/usr/include/c++/7/bits/stl_function.h:375:7: note:   no known conversion for argument 1 from 'peanuts' to 'const int&'
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/7/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = peanuts; _Iterator = peanuts*; _Compare = std::greater<int>]':
/usr/include/c++/7/bits/stl_algo.h:1828:20:   required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Val_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1855:36:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1885:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1971:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:4868:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = peanuts*; _Compare = std::greater<int>]'
/in/foo.cc:30:136:   required from here
/usr/include/c++/7/bits/predefined_ops.h:215:11: error: no match for call to '(std::greater<int>) (peanuts&, peanuts&)'
  { return bool(_M_comp(__val, *__it)); }
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/string:48:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/7/bits/stl_function.h:375:7: note: candidate: bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = int]
       operator()(const _Tp& __x, const _Tp& __y) const
       ^~~~~~~~
/usr/include/c++/7/bits/stl_function.h:375:7: note:   no known conversion for argument 1 from 'peanuts' to 'const int&'
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/7/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = peanuts*; _Value = peanuts; _Compare = std::greater<int>]':
/usr/include/c++/7/bits/stl_heap.h:133:48:   required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = peanuts*; _Distance = long int; _Tp = peanuts; _Compare = __gnu_cxx::__ops::_Iter_comp_val<std::greater<int> >]'
/usr/include/c++/7/bits/stl_heap.h:237:23:   required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = peanuts*; _Distance = long int; _Tp = peanuts; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_heap.h:342:22:   required from 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1672:23:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1933:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1948:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = peanuts*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:1968:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = peanuts*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >]'
/usr/include/c++/7/bits/stl_algo.h:4868:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = peanuts*; _Compare = std::greater<int>]'
/in/foo.cc:30:136:   required from here
/usr/include/c++/7/bits/predefined_ops.h:177:11: error: no match for call to '(std::greater<int>) (peanuts&, peanuts&)'
  { return bool(_M_comp(*__it, __val)); }
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/string:48:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
         

信息

递交者
类型
递交
题目
P1120 花生采摘
语言
C++
递交时间
2017-10-07 11:22:02
评测时间
2017-10-07 11:22:02
评测机
分数
0
总耗时
387ms
峰值内存
37.312 MiB