#2058
Submat
Se consideră o matrice A
având N
linii și N
coloane. Elementele acesteia aparțin mulțimii {0,1,2}
. Pe fiecare linie și pe fiecare coloană valorile elementelor sunt dispuse crescător.
Fie două elemente din matrice situate pe linia i1
și coloana j1
respectiv i2
și j2
,unde i1≤i2
și j1≤j2
. O submatrice a lui A
, având colțurile stânga-sus şi dreapta-jos în (i1,j1)
și (i2,j2)
, este formată din toate elementele situate pe linii cuprinse între i1
și i2
, inclusiv, și coloane între j1
și j2
, inclusiv. Numim submatrice constantă o submatrice a matricei A
, având toate elementele egale.
Realizați un program care determină numărul maxim K
de elemente pe care îl are o submatrice constantă a lui A
și numărul submatricilor constante formate din K
elemente.
ONIGIM 2017, Clasa a VII-a
Problema | Submat | Operații I/O |
submat.in /submat.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 256 MB
/
Stivă 32 MB
|
Id soluție | #50696747 | Utilizator | |
Fișier | submat.cpp | Dimensiune | 1.47 KB |
Data încărcării | 22 Aprilie 2024, 11:00 | Scor / rezultat | Eroare de compilare |
submat.cpp: In function 'int main()': submat.cpp:24:45: error: no matching function for call to 'min(ll, int)' if ( a==0 ) v[i][0].st=min(b-1,1),v[i][0].dr=b-1, ^ submat.cpp:24:45: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from submat.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: submat.cpp:24:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') if ( a==0 ) v[i][0].st=min(b-1,1),v[i][0].dr=b-1, ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from submat.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: submat.cpp:24:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') if ( a==0 ) v[i][0].st=min(b-1,1),v[i][0].dr=b-1, ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from submat.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: submat.cpp:24:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' if ( a==0 ) v[i][0].st=min(b-1,1),v[i][0].dr=b-1, ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from submat.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: submat.cpp:24:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' if ( a==0 ) v[i][0].st=min(b-1,1),v[i][0].dr=b-1, ^ submat.cpp:28:45: error: no matching function for call to 'min(ll, int)' if ( b==0 ) v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ submat.cpp:28:45: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from submat.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: submat.cpp:28:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') if ( b==0 ) v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from submat.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: submat.cpp:28:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') if ( b==0 ) v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from submat.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: submat.cpp:28:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' if ( b==0 ) v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from submat.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: submat.cpp:28:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' if ( b==0 ) v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ submat.cpp:32:45: error: no matching function for call to 'min(ll, int)' v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ submat.cpp:32:45: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from submat.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: submat.cpp:32:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from submat.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: submat.cpp:32:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from submat.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: submat.cpp:32:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from submat.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: submat.cpp:32:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' v[i][0].st=min(a-1,1),v[i][0].dr=a-1, ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Submat 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ă.