제출 #403880

#제출 시각아이디문제언어결과실행 시간메모리
403880Iwanttobreakfree곤돌라 (IOI14_gondola)C++98
컴파일 에러
0 ms0 KiB
#include "gondola.h" #include <vector> #include <set> using namespace std; int valid(int n, int inputSeq[]){ int mini=1e9,pos,cont=0; for(int i=0;i<n;i++){ if(inputSeq[i]<mini){ mini=inputSeq[i]; pos=i; } } set<int> s; vector<int>v(n); for(int i=pos;i<n;i++){ v[cont]=inputSeq[i]; cont++; } for(int i=0;i<pos;i++){ v[cont]=inputSeq[i]; cont++; } for(int i=0;i<n;i++){ if(v[i]>n){ if(s.find(v[i]==s.end())){ s.insert(v[i]); } else return 0; } if(v[i]-mini!=i)return 0; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]){ /*int mini=1e9,pos,cont=0; for(int i=0;i<n;i++){ if(inputSeq[i]<mini){ mini=inputSeq[i]; pos=i; } } vector<int>v(n); for(int i=pos;i<n;i++){ v[cont]=inputSeq[i]; cont++; } for(int i=0;i<pos;i++){ v[cont]=inputSeq[i]; cont++; }*/ return 0; } int countReplacement(int n, int inputSeq[]){ return -3; }

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

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:25:19: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'})
   25 |     if(s.find(v[i]==s.end())){
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from gondola.cpp:2:
/usr/include/c++/10/bits/stl_pair.h:466:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  466 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:466:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from gondola.cpp:2:
/usr/include/c++/10/bits/stl_iterator.h:360:5: note: candidate: 'template<class _Iterator> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  360 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:360:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from gondola.cpp:2:
/usr/include/c++/10/bits/stl_iterator.h:398:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  398 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:398:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from gondola.cpp:2:
/usr/include/c++/10/bits/stl_iterator.h:1427:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator==(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1427 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1427:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from gondola.cpp:2:
/usr/include/c++/10/bits/stl_iterator.h:1495:5: note: candidate: 'template<class _Iterator> bool std::operator==(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1495 |     operator==(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1495:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/vector:64,
                 from gondola.cpp:2:
/usr/include/c++/10/bits/allocator.h:206:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const std::allocator<_Tp1>&, const std::allocator<_T2>&)'
  206 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
/usr/include/c++/10/bits/allocator.h:206:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::allocator<_Tp1>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/vector:67,
                 from gondola.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:1892:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)'
 1892 |     operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1892:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/set:61,
                 from gondola.cpp:3:
/usr/include/c++/10/bits/stl_set.h:985:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator==(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&)'
  985 |     operator==(const set<_Key, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_set.h:985:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::set<_Key, _Compare, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/set:62,
                 from gondola.cpp:3:
/usr/include/c++/10/bits/stl_multiset.h:971:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator==(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&)'
  971 |     operator==(const multiset<_Key, _Compare, _Alloc>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_multiset.h:971:5: note:   template argument deduction/substitution failed:
gondola.cpp:25:27: note:   mismatched types 'const std::multiset<_Key, _Compare, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   25 |     if(s.find(v[i]==s.end())){
      |                           ^
In file included from /usr/include/c++/10/set:60,
                 from gondola.cpp:3:
/usr/include/c++/10/bits/stl_tree.h:396:7: note: candidate: 'bool std::operator==(const _Self&, const _Self&)'
  396 |       operator==(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:396:31: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const _Self&'
  396 |       operator==(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~~~~^~~