# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315109 | 2020-10-22T02:35:56 Z | thtsshz_bgwrswh | Mouse (info1cup19_mouse) | C++17 | Compilation error |
0 ms | 0 KB |
#pragma GCC optimize("Ofast") #include "grader.h" #include<stdio.h> #include<algorithm> #include<assert.h> using namespace std; int num[260]; vector<int> temp,temp2; int Q(int n,int id,int j){ int i,a,b; for(i=1;i<=n;i++) if(i!=j) a=i; for(i=1;i<=n;i++) if(i!=j&&i!=a) b=i; for(i=0;i<n;i++){ temp[i]=a; temp2[i]=b; } temp[id]=temp2[id]=j; return query(temp)&&query(temp2); } void solve(int n){ int i,j; temp.resize(n+1); temp2.reserve(n+1); for(i=0;i<n;i++) for(j=1;j<=n;j++){ if(Q(n,i,j)){ num[i]=j; break; } } vector<int> ans(n+1); for(i=0;i<n;i++) ans[i]=num[i]; sort(ans,ans+n); for(i=0;i<n;i++) assert(ans[i]!=i); query(ans); }
Compilation message
mouse.cpp: In function 'void solve(int)': mouse.cpp:38:14: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int') 38 | sort(ans,ans+n); | ~~~^~ | | | | | int | std::vector<int> In file included from /usr/include/c++/9/bits/stl_algobase.h:67, from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/stl_iterator.h:423:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)' 423 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/9/bits/stl_iterator.h:423:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/bits/stl_algobase.h:67, from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/stl_iterator.h:1219:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)' 1219 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/9/bits/stl_iterator.h:1219:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6020:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 6020 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6020:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:56, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.tcc:1158:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 1158 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.tcc:1158:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: mismatched types 'const _CharT*' and 'std::vector<int>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:56, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.tcc:1174:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 1174 | operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.tcc:1174:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6057:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 6057 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6057:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6073:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 6073 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6073:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6085:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 6085 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6085:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6091:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 6091 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6091:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6097:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 6097 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6097:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6109:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 6109 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6109:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: mismatched types 'const _CharT*' and 'std::vector<int>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6115:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 6115 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6115:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6121:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 6121 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6121:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/bits/basic_string.h:6127:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 6127 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6127:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/complex:327:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&)' 327 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/9/complex:327:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/complex:336:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const _Tp&)' 336 | operator+(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/9/complex:336:5: note: template argument deduction/substitution failed: mouse.cpp:38:15: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' 38 | sort(ans,ans+n); | ^ In file included from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from grader.h:5, from mouse.cpp:2: /usr/include/c++/9/complex:345:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const _Tp&