#2943
Se dă o matrice pătratică de n x n numere naturale și o valoare naturală T. Suma unei submatrice este suma elementelor submatricei. Să se determine numărul submatricelor care au suma mai mică sau egală cu T.
| Problema | maru | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64213325 | Utilizator | |
| Fișier | maru.cpp | Dimensiune | 455 B |
| Data încărcării | 23 Aprilie 2026, 10:41 | Scor/rezultat | Eroare de compilare |
maru.cpp:4:51: error: redefinition of ‘int i’ 4 | int n , t , i , j , a , b , c , d , A[401][401], i, j, s[401][401], k1, k2 , nr ; | ^ maru.cpp:4:13: note: ‘int i’ previously declared here 4 | int n , t , i , j , a , b , c , d , A[401][401], i, j, s[401][401], k1, k2 , nr ; | ^ maru.cpp:4:54: error: redefinition of ‘int j’ 4 | int n , t , i , j , a , b , c , d , A[401][401], i, j, s[401][401], k1, k2 , nr ; | ^ maru.cpp:4:18: note: ‘int j’ previously declared here 4 | int n , t , i , j , a , b , c , d , A[401][401], i, j, s[401][401], k1, k2 , nr ; | ^ maru.cpp: In function ‘int main()’: maru.cpp:6:15: error: no match for ‘operator>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘int’) 6 | { cin>>t>>a>>b>c>>d ; | ~~~~~~~~~~~~^~~~~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} maru.cpp:6:15: note: candidate: ‘operator>(int, int)’ (built-in) 6 | { cin>>t>>a>>b>c>>d ; | ~~~~~~~~~~~~^~~~~ maru.cpp:6:15: note: no known conversion for argument 1 from ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} to ‘int’ In file included from /usr/include/c++/13/string:48, 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, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from maru.cpp:1: /usr/include/c++/13/bits/stl_iterator.h:469:5: note: candidate: ‘template<class _Iterator> bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)’ 469 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::reverse_iterator<_Iterator>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ /usr/include/c++/13/bits/stl_iterator.h:514:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’ 514 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:514:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::reverse_iterator<_Iterator>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ /usr/include/c++/13/bits/stl_iterator.h:1725:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ 1725 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1725:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::move_iterator<_IteratorL>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ /usr/include/c++/13/bits/stl_iterator.h:1784:5: note: candidate: ‘template<class _Iterator> bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)’ 1784 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1784:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::move_iterator<_IteratorL>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ In file included from /usr/include/c++/13/bits/stl_algobase.h:64, from /usr/include/c++/13/string:51: /usr/include/c++/13/bits/stl_pair.h:848:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’ 848 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/13/bits/stl_pair.h:848:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::pair<_T1, _T2>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ In file included from /usr/include/c++/13/string:54: /usr/include/c++/13/bits/basic_string.h:3870:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3870 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3870:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ /usr/include/c++/13/bits/basic_string.h:3884:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’ 3884 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3884:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ /usr/include/c++/13/bits/basic_string.h:3897:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3897 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3897:5: note: template argument deduction/substitution failed: maru.cpp:6:19: note: mismatched types ‘const _CharT*’ and ‘std::basic_istream<char>’ 6 | { cin>>t>>a>>b>c>>d ; | ^ maru.cpp:8:15: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 8 | for(j=1; j<=m ; j++){} | ^ | tm maru.cpp:7:1: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 7 | for(i=1; i<=n ; i++) | ^~~ maru.cpp:9:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 9 | A[i][j]=(a*i+b*j+c)%d | ^ maru.cpp:9:24: error: expected ‘;’ before ‘s’ 9 | A[i][j]=(a*i+b*j+c)%d | ^ | ; 10 | s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+A[i][j]; | ~ maru.cpp: At global scope: maru.cpp:12:1: error: expected unqualified-id before ‘for’ 12 | for(k1=1; k1<=n; k1++) for(k2=1; k2<=n ; k2++) | ^~~ maru.cpp:12:11: error: ‘k1’ does not name a type 12 | for(k1=1; k1<=n; k1++) for(k2=1; k2<=n ; k2++) | ^~ maru.cpp:12:18: error: ‘k1’ does not name a type 12 | for(k1=1; k1<=n; k1++) for(k2=1; k2<=n ; k2++) | ^~ maru.cpp:12:34: error: ‘k2’ does not name a type 12 | for(k1=1; k1<=n; k1++) for(k2=1; k2<=n ; k2++) | ^~ maru.cpp:12:42: error: ‘k2’ does not name a type 12 | for(k1=1; k1<=n; k1++) for(k2=1; k2<=n ; k2++) | ^~ maru.cpp:13:15: error: ‘i’ does not name a type 13 | for(i=k1; i<=n ; i++) | ^ maru.cpp:13:22: error: ‘i’ does not name a type 13 | for(i=k1; i<=n ; i++) | ^ maru.cpp:16:5: error: expected unqualified-id before ‘return’ 16 | return 0; | ^~~~~~ maru.cpp:17:1: error: expected declaration before ‘}’ token 17 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema maru 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ă.