编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#3783 | #1011. 小田的存钱罐 | Compile Error | 0 | 0 ms | 0 K | C++ 17 / 782 B | Mingzhen_Huang | 2023-11-25 16:52:05 |
using namespace std;
const int N = 2e5 + 10;
// vector<int> v;
set<int> s;
int hash;
int
编译信息
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:22:4: error: reference to 'hash' is ambiguous
22 | hash[x]++;
| ^~~~
In file included from /usr/include/c++/10/string_view:42,
from /usr/include/c++/10/bits/basic_string.h:48,
from /usr/include/c++/10/string:55,
from /usr/include/c++/10/bits/locale_classes.h:40,
from /usr/include/c++/10/bits/ios_base.h:41,
from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/ostream:38,
from /usr/include/c++/10/iostream:39,
from /sandbox/1/a.cpp:1:
/usr/include/c++/10/bits/functional_hash.h:58:12: note: candidates are: 'template<class _Tp> struct std::hash'
58 | struct hash;
| ^~~~
/sandbox/1/a.cpp:10:5: note: 'int hash [200010]'
10 | int hash[N];
| ^~~~
/sandbox/1/a.cpp:28:5: error: reference to 'hash' is ambiguous
28 | hash[x]--;
| ^~~~
In file included from /usr/include/c++/10/string_view:42,
from /usr/include/c++/10/bits/basic_string.h:48,
from /usr/include/c++/10/string:55,
from /usr/include/c++/10/bits/locale_classes.h:40,
from /usr/include/c++/10/bits/ios_base.h:41,
from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/ostream:38,
from /usr/include/c++/10/iostream:39,
from /sandbox/1/a.cpp:1:
/usr/include/c++/10/bits/functional_hash.h:58:12: note: candidates are: 'template<class _Tp> struct std::hash'
58 | struct hash;
| ^~~~
/sandbox/1/a.cpp:10:5: note: 'int hash [200010]'
10 | int hash[N];
| ^~~~
/sandbox/1/a.cpp:32:7: error: reference to 'hash' is ambiguous
32 | if(hash[x] == 0) {
| ^~~~
In file included from /usr/include/c++/10/string_view:42,
from /usr/include/c++/10/bits/basic_string.h:48,
from /usr/include/c++/10/string:55,
from /usr/include/c++/10/bits/locale_classes.h:40,
from /usr/include/c++/10/bits/ios_base.h:41,
from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/ostream:38,
from /usr/include/c++/10/iostream:39,
from /sandbox/1/a.cpp:1:
/usr/include/c++/10/bits/functional_hash.h:58:12: note: candidates are: 'template<class _Tp> struct std::hash'
58 | struct hash;
| ^~~~
/sandbox/1/a.cpp:10:5: note: 'int hash [200010]'
10 | int hash[N];
| ^~~~
/sandbox/1/a.cpp:33:58: error: no matching function for call to 'std::set<int>::find(std::set<int>::iterator, std::set<int>::iterator, int&)'
33 | set<int>::iterator pos = s.find(s.begin(), s.end(), x);
| ^
In file included from /usr/include/c++/10/set:61,
from /sandbox/1/a.cpp:4:
/usr/include/c++/10/bits/stl_set.h:794:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]'
794 | find(const key_type& __x)
| ^~~~
/usr/include/c++/10/bits/stl_set.h:794:7: note: candidate expects 1 argument, 3 provided
/usr/include/c++/10/bits/stl_set.h:798:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]'
798 | find(const key_type& __x) const
| ^~~~
/usr/include/c++/10/bits/stl_set.h:798:7: note: candidate expects 1 argument, 3 provided
/usr/include/c++/10/bits/stl_set.h:804:2: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::iterator{((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
804 | find(const _Kt& __x)
| ^~~~
/usr/include/c++/10/bits/stl_set.h:804:2: note: template argument deduction/substitution failed:
/sandbox/1/a.cpp:33:58: note: candidate expects 1 argument, 3 provided
33 | set<int>::iterator pos = s.find(s.begin(), s.end(), x);
| ^
In file included from /usr/include/c++/10/set:61,
from /sandbox/1/a.cpp:4:
/usr/include/c++/10/bits/stl_set.h:810:2: note: candidate: 'template<class _Kt> decltype (std::set<_Key, _Compare, _Alloc>::const_iterator{((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::set<_Key, _Compare, _Alloc>::find(const _Kt&) const [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
810 | find(const _Kt& __x) const
| ^~~~
/usr/include/c++/10/bits/stl_set.h:810:2: note: template argument deduction/substitution failed:
/sandbox/1/a.cpp:33:58: note: candidate expects 1 argument, 3 provided
33 | set<int>::iterator pos = s.find(s.begin(), s.end(), x);
| ^
/sandbox/1/a.cpp:34:19: error: no matching function for call to 'std::set<int>::erase(std::set<int>::iterator&, int)'
34 | s.erase(pos, 1);
| ^
In file included from /usr/include/c++/10/set:61,
from /sandbox/1/a.cpp:4:
/usr/include/c++/10/bits/stl_set.h:654:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator]'
654 | erase(const_iterator __position)
| ^~~~~
/usr/include/c++/10/bits/stl_set.h:654:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_set.h:684:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::size_type = unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = int]'
684 | erase(const key_type& __x)
| ^~~~~
/usr/include/c++/10/bits/stl_set.h:684:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_set.h:706:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator]'
706 | erase(const_iterator __first, const_iterator __last)
| ^~~~~
/usr/include/c++/10/bits/stl_set.h:706:52: note: no known conversion for argument 2 from 'int' to 'std::set<int>::const_iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'}
706 | erase(const_iterator __first, const_iterator __last)
| ~~~~~~~~~~~~~~~^~~~~~