#2861
puncte4
Zăhărel a desenat pe o foaie de hârtie N
puncte în plan. Curios din fire, şi-a ales încă M
puncte pe axa OX
şi s-a întrebat pentru fiecare dintre cele M
puncte de pe axa Ox
care dintre cele N
puncte este cel mai apropiat (situat la distanță minimă). Se consideră că distanța dintre două puncte (x1, y1)
şi (x2, y2)
este (x1-x2)
2
+ (y1-y2)
2
. Scrieți un program pentru Zăhărel care să determine pentru fiecare dintre cele M
puncte de pe axa OX
, care este distanța la cel mai apropiat punct dintre cele N
desenate pe hârtie.
ONI 2007 Baraj
Problema | puncte4 | Operații I/O |
puncte4.in /puncte4.out
|
---|---|---|---|
Limita timp | 0.4 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #42932048 | Utilizator | |
Fișier | puncte4.cpp | Dimensiune | 1.27 KB |
Data încărcării | 23 Martie 2023, 00:59 | Scor / rezultat | Eroare de compilare |
puncte4.cpp: In function 'int main()': puncte4.cpp:30:16: error: variable 'std::ifstream f' has initializer but incomplete type ifstream f ("puncte4.in"); ^ puncte4.cpp:31:16: error: variable 'std::ofstream g' has initializer but incomplete type ofstream g ("puncte4.out"); ^ puncte4.cpp:35:17: error: request for member 'x' in '*(p + ((sizetype)i))', which is of non-class type 'char' f>>p[i].x>>p[i].y; ^ puncte4.cpp:35:25: error: request for member 'y' in '*(p + ((sizetype)i))', which is of non-class type 'char' f>>p[i].x>>p[i].y; ^ puncte4.cpp:37:22: error: no matching function for call to 'get()' P[i].x = get(); ^ puncte4.cpp:37:22: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:60:0, from puncte4.cpp:2: /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: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/algorithm:60:0, from puncte4.cpp:2: /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: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/algorithm:60:0, from puncte4.cpp:2: /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: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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<_Elements ...> >::type>::type std::get(std::tuple<_Elements ...>&) get(tuple<_Elements...>& __t) noexcept ^ /usr/include/c++/4.8/tuple:759:5: note: template argument deduction/substitution failed: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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<_Elements ...> >::type>::type std::get(const std::tuple<_Elements ...>&) get(const tuple<_Elements...>& __t) noexcept ^ /usr/include/c++/4.8/tuple:766:5: note: template argument deduction/substitution failed: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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<_Elements ...> >::type>::type std::get(std::tuple<_Elements ...>&&) get(tuple<_Elements...>&& __t) noexcept ^ /usr/include/c++/4.8/tuple:773:5: note: template argument deduction/substitution failed: puncte4.cpp:37:22: note: candidate expects 1 argument, 0 provided P[i].x = get(); ^ puncte4.cpp:38:22: error: no matching function for call to 'get()' P[i].y = get(); ^ puncte4.cpp:38:22: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:60:0, from puncte4.cpp:2: /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: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/algorithm:60:0, from puncte4.cpp:2: /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: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/algorithm:60:0, from puncte4.cpp:2: /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: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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<_Elements ...> >::type>::type std::get(std::tuple<_Elements ...>&) get(tuple<_Elements...>& __t) noexcept ^ /usr/include/c++/4.8/tuple:759:5: note: template argument deduction/substitution failed: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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<_Elements ...> >::type>::type std::get(const std::tuple<_Elements ...>&) get(const tuple<_Elements...>& __t) noexcept ^ /usr/include/c++/4.8/tuple:766:5: note: template argument deduction/substitution failed: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from puncte4.cpp:2: /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<_Elements ...> >::type>::type std::get(std::tuple<_Elements ...>&&) get(tuple<_Elements...>&& __t) noexcept ^ /usr/include/c++/4.8/tuple:773:5: note: template argument deduction/substitution failed: puncte4.cpp:38:22: note: candidate expects 1 argument, 0 provided P[i].y = get(); ^ puncte4.cpp:58:28: error: 'qr' was not declared in this scope g<<qr(x-P[stk[i]].x)+sqr(P[stk[i]].y)<<'\n'; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema puncte4 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ă.