#2387
mosia1
Păcală a primit, aşa cum era învoiala, un petec de teren de pe moşia boierului. Terenul este împrejmuit complet cu segmente drepte de gard ce se sprijină la ambele capete de câte un par zdravăn. La o nouă prinsoare, Păcală iese iar in câştig şi primeşte dreptul să strămute nişte pari, unul câte unul, cum i-o fi voia, astfel încât să-şi extindă suprafaţa de teren. Dar învoiala prevede că fiecare par poate fi mutat în orice direcţie, dar nu pe o distanţă mai mare decât o valoare dată (scrisă pe fiecare par) şi fiecare segment de gard, fiind cam şubred, poate fi rotit şi prelungit de la un singur capăt, celălalt rămânând nemişcat.
Cunoscând poziţiile iniţiale ale parilor şi valoarea înscrisă pe fiecare par, se cere suprafaţa maximă cu care poate să-şi extindă Păcală proprietatea. Se ştie că parii sunt daţi într-o ordine oarecare, poziţiile lor iniţiale sunt date prin numere întregi de cel mult 3
cifre, distanțele pe care fiecare par poate fi deplasat sunt numere naturale strict pozitive şi figura formată de terenul iniţial este un poligon neconcav.
OJI 2004
Problema | mosia1 | Operații I/O |
mosia1.in /mosia1.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51406845 | Utilizator | |
Fișier | mosia1.cpp | Dimensiune | 1.46 KB |
Data încărcării | 13 Iunie 2024, 12:21 | Scor / rezultat | Eroare de compilare |
mosia1.cpp: In function 'int main()': mosia1.cpp:64:42: error: no matching function for call to 'max(int&, double)' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ mosia1.cpp:64:42: 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 mosia1.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: mosia1.cpp:64:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'double') dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ 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 mosia1.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: mosia1.cpp:64:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'double') dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from mosia1.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template argument deduction/substitution failed: mosia1.cpp:64:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from mosia1.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template argument deduction/substitution failed: mosia1.cpp:64:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ mosia1.cpp:71:42: error: no matching function for call to 'max(int&, double)' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ mosia1.cpp:71:42: 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 mosia1.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: mosia1.cpp:71:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'double') dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ 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 mosia1.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: mosia1.cpp:71:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'double') dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from mosia1.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template argument deduction/substitution failed: mosia1.cpp:71:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from mosia1.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template argument deduction/substitution failed: mosia1.cpp:71:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ mosia1.cpp:79:42: error: no matching function for call to 'max(int&, double)' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ mosia1.cpp:79:42: 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 mosia1.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: mosia1.cpp:79:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'double') dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ 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 mosia1.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: mosia1.cpp:79:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'double') dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from mosia1.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template argument deduction/substitution failed: mosia1.cpp:79:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from mosia1.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template argument deduction/substitution failed: mosia1.cpp:79:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int' dp[i]=max(dp[i-1], dp[i-2]+val[i]); ^ mosia1.cpp:35:15: warning: unused variable 'j' [-Wunused-variable] int n, i, j, poz1, poz2; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema mosia1 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ă.