Se dă un șir de matrice pătratice asupra căruia se pot face două tipuri de operații: actualizare a unui element (se înlocuiește matricea de pe acea poziție cu alta) și interogarea unui interval de indici (determinarea produsului matricelor memorate între cei doi indici, inclusiv).
Problema | Actualizare Element, Produs Interval, Matrice | Operații I/O |
aepim.in /aepim.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #46560651 | Utilizator | |
Fișier | actualizare_element,_produs_interval,_matrice.cpp | Dimensiune | 2.85 KB |
Data încărcării | 16 Noiembrie 2023, 23:47 | Scor / rezultat | Eroare de compilare |
actualizare_element,_produs_interval,_matrice.cpp: In function 'void prelucrare(int, int, int)': actualizare_element,_produs_interval,_matrice.cpp:28:17: error: no match for 'operator=' (operand types are 'std::vector<short int>' and 'std::vector<int>') aint[p] = produs(aint[fs],aint[fd]); ^ actualizare_element,_produs_interval,_matrice.cpp:28:17: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = short int; _Alloc = std::allocator<short int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<short int>&' In file included from /usr/include/c++/4.8/vector:64:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<short int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<short int>' actualizare_element,_produs_interval,_matrice.cpp: In function 'std::vector<int> interogare(int, int, int)': actualizare_element,_produs_interval,_matrice.cpp:36:22: error: could not convert 'aint[p]' from 'std::vector<short int>' to 'std::vector<int>' return aint[p]; ^ actualizare_element,_produs_interval,_matrice.cpp:43:14: error: no match for 'operator=' (operand types are 'std::vector<short int>' and 'std::vector<int>') vec1 = interogare(2*p+1,st,m); ^ actualizare_element,_produs_interval,_matrice.cpp:43:14: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = short int; _Alloc = std::allocator<short int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<short int>&' In file included from /usr/include/c++/4.8/vector:64:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<short int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<short int>' actualizare_element,_produs_interval,_matrice.cpp:48:14: error: no match for 'operator=' (operand types are 'std::vector<short int>' and 'std::vector<int>') vec2 = interogare(2*p+2,m+1,dr); ^ actualizare_element,_produs_interval,_matrice.cpp:48:14: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = short int; _Alloc = std::allocator<short int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<short int>&' In file included from /usr/include/c++/4.8/vector:64:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<short int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<short int>' actualizare_element,_produs_interval,_matrice.cpp:51:16: error: could not convert 'vec1' from 'std::vector<short int>' to 'std::vector<int>' return vec1; ^ actualizare_element,_produs_interval,_matrice.cpp:53:16: error: could not convert 'vec2' from 'std::vector<short int>' to 'std::vector<int>' return vec2; ^ actualizare_element,_produs_interval,_matrice.cpp:38:9: warning: unused variable 'fs' [-Wunused-variable] int fs = 2 * p + 1, fd = 2*p+2, m = ((st+dr)>>1), ok = 0; ^ actualizare_element,_produs_interval,_matrice.cpp:38:25: warning: unused variable 'fd' [-Wunused-variable] int fs = 2 * p + 1, fd = 2*p+2, m = ((st+dr)>>1), ok = 0; ^ actualizare_element,_produs_interval,_matrice.cpp: In function 'void modificare(int, int, int)': actualizare_element,_produs_interval,_matrice.cpp:72:17: error: no match for 'operator=' (operand types are 'std::vector<short int>' and 'std::vector<int>') aint[p] = produs(aint[fs],aint[fd]); ^ actualizare_element,_produs_interval,_matrice.cpp:72:17: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = short int; _Alloc = std::allocator<short int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<short int>&' In file included from /usr/include/c++/4.8/vector:64:0, from actualizare_element,_produs_interval,_matrice.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<short int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = short int; _Alloc = std::allocator<short int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<short int>' actualizare_element,_produs_interval,_matrice.cpp: In function 'int main()': actualizare_element,_produs_interval,_matrice.cpp:100:50: error: conversion from 'std::vector<int>' to non-scalar type 'std::vector<short int>' requested vector <short> vec = interogare(0,1,n); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Actualizare Element, Produs Interval, Matrice face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.