#1189
Lenes
Leneşul este un animal foarte leneş. El se deplasează numai în linie dreaptă, dar face din când în când câte un popas. În această problemă leneşul trebuie să traverseze de la nord la sud şi înapoi un teren reprezentat de o matrice de dimensiuni M×N
cu valori numere naturale. Valorile reprezintă efortul cerut pentru traversarea zonei respective. Leneşul va alege o coloană pentru traversarea matricei, iar pentru popasuri, în număr de k1
, va alege zone alăturate drumului din coloana din stânga sau cea din dreapta. În cazul în care se va întoarce va proceda la fel, dar va face k2
popasuri. Regulile problemei cer ca cele două drumuri să nu aibă zone comune.
Cunoscând dimensiunile M
, N
ale terenului, numărul de popasuri k1
, k2
și efortul pentru traversarea fiecărei zone a terenului, să se determine:
k1
popasuri.k1
popasuri la deplasarea Nord – Sud, respectiv k2
popasuri la deplasarea Sud – Nord.ONI 2015, Clasa a IX-a
Problema | Lenes | Operații I/O |
lenes.in /lenes.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 4 MB
|
Id soluție | #50562983 | Utilizator | |
Fișier | lenes.cpp | Dimensiune | 3.03 KB |
Data încărcării | 15 Aprilie 2024, 13:01 | Scor / rezultat | Eroare de compilare |
lenes.cpp: In function 'long long int get1(long long int, long long int)': lenes.cpp:14:54: error: no matching function for call to 'min(long long int&, int)' ans=min(ans, sp[i][m]+sp[i-1][p]+sp[i+1][k-p]); ^ lenes.cpp:14:54: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from lenes.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: lenes.cpp:14:54: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans=min(ans, sp[i][m]+sp[i-1][p]+sp[i+1][k-p]); ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from lenes.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: lenes.cpp:14:54: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') ans=min(ans, sp[i][m]+sp[i-1][p]+sp[i+1][k-p]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from lenes.cpp:2: /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: lenes.cpp:14:54: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans=min(ans, sp[i][m]+sp[i-1][p]+sp[i+1][k-p]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from lenes.cpp:2: /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: lenes.cpp:14:54: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans=min(ans, sp[i][m]+sp[i-1][p]+sp[i+1][k-p]); ^ lenes.cpp: In function 'long long int get3(long long int, long long int, long long int)': lenes.cpp:30:30: error: no matching function for call to 'min(long long int, int&)' for (p=1; p<=min(k1+k2, m); p++) ^ lenes.cpp:30:30: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from lenes.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: lenes.cpp:30:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') for (p=1; p<=min(k1+k2, m); p++) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from lenes.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: lenes.cpp:30:30: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') for (p=1; p<=min(k1+k2, m); p++) ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from lenes.cpp:2: /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: lenes.cpp:30:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' for (p=1; p<=min(k1+k2, m); p++) ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from lenes.cpp:2: /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: lenes.cpp:30:30: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' for (p=1; p<=min(k1+k2, m); p++) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Lenes 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ă.