# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
18428 | 2016-02-01T13:21:12 Z | mindol | 구간 성분 (KOI15_interval) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include<iostream> #include<set> #include<algorithm> #include<vector> #include<string> using namespace std; string A,B; set<vector<short>> S; int main() { cin>>A>>B; for(int i=0;i<A.size();i++) { vector<int> p(26,0); for(int j=i;j<A.size();j++) { p[A[j]-'a']++; S.insert(p); } } int ans=0; for(int i=0;i<B.size();i++) { vector<int> p(26,0); for(int j=i;j<B.size();j++) { p[B[j]-'a']++; auto it=S.find(p); if(it!=S.end()) ans=max(ans,j-i+1); } } cout<<ans; return 0; }
Compilation message
interval.cpp: In function ‘int main()’: interval.cpp:12:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<A.size();i++) ^ interval.cpp:15:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j=i;j<A.size();j++) ^ interval.cpp:18:23: error: no matching function for call to ‘std::set<std::vector<short int> >::insert(std::vector<int>&)’ S.insert(p); ^ interval.cpp:18:23: note: candidates are: In file included from /usr/include/c++/4.9/set:61:0, from interval.cpp:2: /usr/include/c++/4.9/bits/stl_set.h:499:7: note: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<short int>] insert(const value_type& __x) ^ /usr/include/c++/4.9/bits/stl_set.h:499:7: note: no known conversion for argument 1 from ‘std::vector<int>’ to ‘const value_type& {aka const std::vector<short int>&}’ /usr/include/c++/4.9/bits/stl_set.h:508:7: note: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<short int>] insert(value_type&& __x) ^ /usr/include/c++/4.9/bits/stl_set.h:508:7: note: no known conversion for argument 1 from ‘std::vector<int>’ to ‘std::set<std::vector<short int> >::value_type&& {aka std::vector<short int>&&}’ /usr/include/c++/4.9/bits/stl_set.h:536:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<short int>] insert(const_iterator __position, const value_type& __x) ^ /usr/include/c++/4.9/bits/stl_set.h:536:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.9/bits/stl_set.h:541:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::vector<short int>] insert(const_iterator __position, value_type&& __x) ^ /usr/include/c++/4.9/bits/stl_set.h:541:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.9/bits/stl_set.h:556:2: note: template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >] insert(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.9/bits/stl_set.h:556:2: note: template argument deduction/substitution failed: interval.cpp:18:23: note: candidate expects 2 arguments, 1 provided S.insert(p); ^ In file included from /usr/include/c++/4.9/set:61:0, from interval.cpp:2: /usr/include/c++/4.9/bits/stl_set.h:568:7: note: void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >] insert(initializer_list<value_type> __l) ^ /usr/include/c++/4.9/bits/stl_set.h:568:7: note: no known conversion for argument 1 from ‘std::vector<int>’ to ‘std::initializer_list<std::vector<short int> >’ interval.cpp:22:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<B.size();i++) ^ interval.cpp:25:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j=i;j<B.size();j++) ^ interval.cpp:28:29: error: no matching function for call to ‘std::set<std::vector<short int> >::find(std::vector<int>&)’ auto it=S.find(p); ^ interval.cpp:28:29: note: candidates are: In file included from /usr/include/c++/4.9/set:61:0, from interval.cpp:2: /usr/include/c++/4.9/bits/stl_set.h:701:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::vector<short int>] find(const key_type& __x) ^ /usr/include/c++/4.9/bits/stl_set.h:701:7: note: no known conversion for argument 1 from ‘std::vector<int>’ to ‘const key_type& {aka const std::vector<short int>&}’ /usr/include/c++/4.9/bits/stl_set.h:705:7: note: std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = std::vector<short int>; _Compare = std::less<std::vector<short int> >; _Alloc = std::allocator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::vector<short int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::vector<short int>] find(const key_type& __x) const ^ /usr/include/c++/4.9/bits/stl_set.h:705:7: note: no known conversion for argument 1 from ‘std::vector<int>’ to ‘const key_type& {aka const std::vector<short int>&}’