Detalii evaluare #57301106

Rezumat problemă

#4786 teren1

Lordul John a decis că a venit vremea să însămânțeze terenul său. Terenul a fost împărțit în parcele organizate în N linii, pe fiecare linie fiind câte N parcele pătrate, fiecare cu suprafața de un metru pătrat. Liniile au fost numerotate de sus în jos de la 1 la N, iar coloanele de la stânga la dreapta de la 1 la N. Fiind un aviator pasionat, a folosit avionul său pentru a survola terenul în vederea însămânțării. La final, după însămânțare, Lordul John dorește să împrejmuiască cu gard parcelele însămânțate, pentru a le separa de cele rămase neînsămânțate sau de marginea terenului.
1. Determinați numărul semințelor care sunt aruncate.
2. Determinați numărul de parcele care sunt însămânțate.
3. Determinați lungimea gardului care trebuie să separe suprafețele însămânțate de cele neînsămânțate sau de marginea terenului.

Detalii

Problema teren1 Operații I/O teren.in/teren.out
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #57301106 Utilizator Pantea Gabriel (grrreeet)
Fișier teren1.cpp Dimensiune 2.46 KB
Data încărcării 25 Martie 2025, 08:38 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

teren1.cpp: In function 'int main()':
teren1.cpp:27:30: error: no matching function for call to 'get(const std::tuple<int, int, int, int>&)'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
teren1.cpp:27:30: note: candidates are:
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:142:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:142:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   types 'std::pair<_Tp1, _Tp2>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:147:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^
/usr/include/c++/4.8/utility:147:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   types 'std::pair<_Tp1, _Tp2>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:152:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:152:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   'const std::tuple<int, int, int, int>' is not derived from 'const std::pair<_Tp1, _Tp2>'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:268:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:268:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   types 'std::array<_Tp, _Nm>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:277:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^
/usr/include/c++/4.8/array:277:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   types 'std::array<_Tp, _Nm>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:285:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:285:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   'const std::tuple<int, int, int, int>' is not derived from 'const std::array<_Tp, _Nm>'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:759:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(std::tuple<_Args2 ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:759:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   types 'std::tuple<_Args2 ...>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:766:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_c_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(const std::tuple<_Args2 ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:766:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   couldn't deduce template parameter '__i'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:773:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_r_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(std::tuple<_Args2 ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:773:5: note:   template argument deduction/substitution failed:
teren1.cpp:27:30: note:   types 'std::tuple<_Args2 ...>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
teren1.cpp:28:37: error: 'lf' was not declared in this scope
             totalSeminte += max(abs(lf - ls), abs(cf - cs)) + 1;

                                     ^
teren1.cpp:28:51: error: 'cf' was not declared in this scope
             totalSeminte += max(abs(lf - ls), abs(cf - cs)) + 1;

                                                   ^
teren1.cpp:28:56: error: 'cs' was not declared in this scope
             totalSeminte += max(abs(lf - ls), abs(cf - cs)) + 1;

                                                        ^
teren1.cpp:34:30: error: no matching function for call to 'get(const std::tuple<int, int, int, int>&)'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
teren1.cpp:34:30: note: candidates are:
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:142:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:142:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   types 'std::pair<_Tp1, _Tp2>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:147:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^
/usr/include/c++/4.8/utility:147:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   types 'std::pair<_Tp1, _Tp2>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:152:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:152:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   'const std::tuple<int, int, int, int>' is not derived from 'const std::pair<_Tp1, _Tp2>'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:268:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:268:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   types 'std::array<_Tp, _Nm>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:277:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^
/usr/include/c++/4.8/array:277:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   types 'std::array<_Tp, _Nm>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:285:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:285:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   'const std::tuple<int, int, int, int>' is not derived from 'const std::array<_Tp, _Nm>'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:759:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(std::tuple<_Args2 ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:759:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   types 'std::tuple<_Args2 ...>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:766:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_c_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(const std::tuple<_Args2 ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:766:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   couldn't deduce template parameter '__i'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:773:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_r_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(std::tuple<_Args2 ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:773:5: note:   template argument deduction/substitution failed:
teren1.cpp:34:30: note:   types 'std::tuple<_Args2 ...>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
teren1.cpp:35:27: error: 'lf' was not declared in this scope
             int deltaL = (lf == ls) ? 0 : (lf - ls > 0 ? 1 : -1);

                           ^
teren1.cpp:36:27: error: 'cf' was not declared in this scope
             int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1);

                           ^
teren1.cpp:36:33: error: 'cs' was not declared in this scope
             int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1);

                                 ^
teren1.cpp:49:30: error: no matching function for call to 'get(const std::tuple<int, int, int, int>&)'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
teren1.cpp:49:30: note: candidates are:
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:142:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:142:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   types 'std::pair<_Tp1, _Tp2>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:147:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^
/usr/include/c++/4.8/utility:147:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   types 'std::pair<_Tp1, _Tp2>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:38:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/utility:152:5: note: template<unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^
/usr/include/c++/4.8/utility:152:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   'const std::tuple<int, int, int, int>' is not derived from 'const std::pair<_Tp1, _Tp2>'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:268:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:268:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   types 'std::array<_Tp, _Nm>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:277:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^
/usr/include/c++/4.8/array:277:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   types 'std::array<_Tp, _Nm>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from /usr/include/c++/4.8/tuple:39:0,
                 from teren1.cpp:6:
/usr/include/c++/4.8/array:285:5: note: template<unsigned int _Int, class _Tp, unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^
/usr/include/c++/4.8/array:285:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   'const std::tuple<int, int, int, int>' is not derived from 'const std::array<_Tp, _Nm>'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:759:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(std::tuple<_Args2 ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:759:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   types 'std::tuple<_Args2 ...>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:766:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_c_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(const std::tuple<_Args2 ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:766:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   couldn't deduce template parameter '__i'
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
In file included from teren1.cpp:6:0:
/usr/include/c++/4.8/tuple:773:5: note: template<unsigned int __i, class ... _Elements> constexpr typename std::__add_r_ref<typename std::tuple_element<__i, std::tuple<_Args2 ...> >::type>::type std::get(std::tuple<_Args2 ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^
/usr/include/c++/4.8/tuple:773:5: note:   template argument deduction/substitution failed:
teren1.cpp:49:30: note:   types 'std::tuple<_Args2 ...>' and 'const std::tuple<int, int, int, int>' have incompatible cv-qualifiers
             int ls = get(zbor), cs = get(zbor), lf = get(zbor), cf = get(zbor);

                              ^
teren1.cpp:50:27: error: 'lf' was not declared in this scope
             int deltaL = (lf == ls) ? 0 : (lf - ls > 0 ? 1 : -1);

                           ^
teren1.cpp:51:27: error: 'cf' was not declared in this scope
             int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1);

                           ^
teren1.cpp:51:33: error: 'cs' was not declared in this scope
             int deltaC = (cf == cs) ? 0 : (cf - cs > 0 ? 1 : -1);

                                 ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema teren1 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.