# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1271678 | pxsit | 모자이크 (IOI24_mosaic) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<long long> mosaic(vector<int> x, vector<int> y,vector<int> T, vector<int> B,vector<int> L, vector<int> R){
int n = x.size(), q = T.size();
vector<long long> ans(q,0);
if(n == 1){
for(int i=0;i<q;i++) ans[i] = x[0];
return ans;
}
vector<int> pref(n,0);
for(int i = 1;i<n;i++) pref[i] = pref[i-1] + x[i];
for(int qrs=0;qrs<q;qrs++){
int t = T[qrs],b = B[qrs],l = L[qrs],r = R[qrs];
if(l == 0){
ans = pref[r];
}else{
ans = pref[r] - pref[l - 1];
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
mosaic.cpp: In function 'std::vector<long long int> mosaic(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)': mosaic.cpp:17:25: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 17 | ans = pref[r]; | ^ In file included from /usr/include/c++/13/vector:72, from /usr/include/c++/13/functional:64, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53, from mosaic.cpp:1: /usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/vector.tcc:211:42: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::vector<long long int>&' 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/13/vector:66: /usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<long long int>&&' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 788 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::initializer_list<long long int>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ mosaic.cpp:19:39: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 19 | ans = pref[r] - pref[l - 1]; | ^ /usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/vector.tcc:211:42: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::vector<long long int>&' 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<long long int>&&' 766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 788 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::initializer_list<long long int>' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~