제출 #974671

#제출 시각아이디문제언어결과실행 시간메모리
974671ivaziva동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; #define MAXN 5010 int pozicija[MAXN]; int vrata[MAXN]; bool pronadjeno[MAXN]; vector<long long> nepronadjeni; void exploreCave(int N) { for (long long i=0;i<N;i++) pozicija[i]=0; for (long long i=0;i<N;i++) pronadjeno[i]=false; for (long long i=0;i<N;i++) vrata[i]=-1; for (long long i=0;i<N;i++) nepronadjeni.insert(i); for (long long i=0;i<N;i++) { for (long long j=0;j<N;j++) { if (pronadjeno[j]) continue; else nepronadjeni.push_back(j); } long long ans0=tryCombination(pozicija); if (ans0>i or ans0==-1) { long long l=0,r=nepronadjeni.size()-1; long long rez=-1; while (l<=r) { long long mid=(l+r)/2; for (long long j=0;j<=mid;j++) pozicija[nepronadjeni[j]]=1-pozicija[nepronadjeni[j]]; long long ans=tryCombination(pozicija); if (ans>i or ans==-1) {rez=mid;r=mid-1;} else l=mid+1; for (long long j=0;j<=mid;j++) pozicija[nepronadjeni[j]]=1-pozicija[nepronadjeni[j]]; } pozicija[nepronajdeni[rez]]=1; vrata[nepronadjeni[rez]]=i; pronadjeno[nepronadjeni[rez]]=true; } else { long long l=0,r=nepronadjeni.size()-1; long long rez=-1; while (l<=r) { long long mid=(l+r)/2; for (long long j=0;j<=mid;j++) pozicija[nepronadjeni[j]]=1-pozicija[nepronadjeni[j]]; long long ans=tryCombination(pozicija); if (ans==i) {rez=mid;r=mid-1;} else l=mid+1; for (long long j=0;j<=mid;j++) pozicija[nepronadjeni[j]]=1-pozicija[nepronadjeni[j]]; } vrata[nepronadjeni[rez]]=i; pronadjeno[nepronadjeni[rez]]=true; } nepronadjeni.clear(); } answer(pozicija,vrata); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:54: error: no matching function for call to 'std::vector<long long int>::insert(long long int&)'
   18 |     for (long long i=0;i<N;i++) nepronadjeni.insert(i);
      |                                                      ^
In file included from /usr/include/c++/10/vector:72,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cave.cpp:1:
/usr/include/c++/10/bits/vector.tcc:130:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = std::vector<long long int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<long long int>::const_iterator; std::vector<_Tp, _Alloc>::value_type = long long int]'
  130 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:130:5: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cave.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1293:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = std::vector<long long int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<long long int>::const_iterator; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1293 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_vector.h:1293:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/10/bits/stl_vector.h:1310:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = std::vector<long long int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<long long int>::const_iterator]'
 1310 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_vector.h:1310:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/10/bits/stl_vector.h:1335:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = std::vector<long long int>::iterator; std::vector<_Tp, _Alloc>::const_iterator = std::vector<long long int>::const_iterator; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1335 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/10/bits/stl_vector.h:1335:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/10/bits/stl_vector.h:1379:2: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::const_iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = long long int; _Alloc = std::allocator<long long int>]'
 1379 |  insert(const_iterator __position, _InputIterator __first,
      |  ^~~~~~
/usr/include/c++/10/bits/stl_vector.h:1379:2: note:   template argument deduction/substitution failed:
cave.cpp:18:54: note:   candidate expects 3 arguments, 1 provided
   18 |     for (long long i=0;i<N;i++) nepronadjeni.insert(i);
      |                                                      ^
cave.cpp:40:22: error: 'nepronajdeni' was not declared in this scope; did you mean 'nepronadjeni'?
   40 |             pozicija[nepronajdeni[rez]]=1;
      |                      ^~~~~~~~~~~~
      |                      nepronadjeni