#786
Se dă o matrice cu n linii şi n coloane şi elemente numere naturale. Să se construiască o matrice care să fie simetrica față de diagonala principală a matricei date.
| Problema | MatSim | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64625841 | Utilizator | |
| Fișier | matsim.cpp | Dimensiune | 465 B |
| Data încărcării | 19 Mai 2026, 10:47 | Scor/rezultat | Eroare de compilare |
matsim.cpp: In lambda function: matsim.cpp:23:37: error: expected ‘{’ before ‘)’ token 23 | swap(mat[i][j],mat[j],[i]); | ^ matsim.cpp: In function ‘int main()’: matsim.cpp:23:16: error: no matching function for call to ‘swap(int&, int [100], main()::<lambda()>)’ 23 | swap(mat[i][j],mat[j],[i]); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/bits/exception_ptr.h:41, from /usr/include/c++/13/exception:164, from /usr/include/c++/13/ios:41, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from matsim.cpp:1: /usr/include/c++/13/bits/move.h:189:5: note: candidate: ‘template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 189 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/13/bits/move.h:189:5: note: template argument deduction/substitution failed: matsim.cpp:23:16: note: deduced conflicting types for parameter ‘_Tp’ (‘int’ and ‘int [100]’) 23 | swap(mat[i][j],mat[j],[i]); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/move.h:213:5: note: candidate: ‘template<class _Tp, long unsigned int _Nm> std::__enable_if_t<std::__is_swappable<_Tp>::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 213 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/13/bits/move.h:213:5: note: template argument deduction/substitution failed: matsim.cpp:23:16: note: mismatched types ‘_Tp [_Nm]’ and ‘int’ 23 | swap(mat[i][j],mat[j],[i]); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/bits/stl_algobase.h:64, from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44: /usr/include/c++/13/bits/stl_pair.h:879:5: note: candidate: ‘template<class _T1, class _T2> void std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)’ 879 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/13/bits/stl_pair.h:879:5: note: template argument deduction/substitution failed: matsim.cpp:23:16: note: mismatched types ‘std::pair<_T1, _T2>’ and ‘int’ 23 | swap(mat[i][j],mat[j],[i]); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/string:54: /usr/include/c++/13/bits/basic_string.h:3994:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Alloc>&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3994 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~ /usr/include/c++/13/bits/basic_string.h:3994:5: note: template argument deduction/substitution failed: matsim.cpp:23:16: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 23 | swap(mat[i][j],mat[j],[i]); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/exception_ptr.h:230:5: note: candidate: ‘void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)’ 230 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/13/bits/exception_ptr.h:230:5: note: candidate expects 2 arguments, 3 provided matsim.cpp:8:24: warning: unused variable ‘d1’ [-Wunused-variable] 8 | long long int n,i,j,d1=0,d2=0,x,mn1=100000,mx1=-100000,mn2=100000,mx2=-100000; | ^~ matsim.cpp:8:29: warning: unused variable ‘d2’ [-Wunused-variable] 8 | long long int n,i,j,d1=0,d2=0,x,mn1=100000,mx1=-100000,mn2=100000,mx2=-100000; | ^~ matsim.cpp:8:34: warning: unused variable ‘x’ [-Wunused-variable] 8 | long long int n,i,j,d1=0,d2=0,x,mn1=100000,mx1=-100000,mn2=100000,mx2=-100000; | ^ matsim.cpp:8:36: warning: unused variable ‘mn1’ [-Wunused-variable] 8 | long long int n,i,j,d1=0,d2=0,x,mn1=100000,mx1=-100000,mn2=100000,mx2=-100000; | ^~~ matsim.cpp:8:47: warning: unused variable ‘mx1’ [-Wunused-variable] 8 | long long int n,i,j,d1=0,d2=0,x,mn1=100000,mx1=-100000,mn2=100000,mx2=-100000; | ^~~ matsim.cpp:8:59: warning: unused variable ‘mn2’ [-Wunused-variable] 8 | long long int n,i,j,d1=0,d2=0,x,mn1=100000,mx1=-100000,mn2=100000,mx2=-100000; | ^~~ matsim.cpp:8:70: warning: unused variable ‘mx2’ [-Wunused-variable] 8 | long long int n,i,j,d1=0,d2=0,x,mn1=100000,mx1=-100000,mn2=100000,mx2=-100000; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MatSim 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ă.