#930
IntersectieSegmente
Se dau două segmente în plan, specificate prin coordonatele capetelor. Să se verifice dacă au cel puțin un punct comun.
Problema | IntersectieSegmente | Operații I/O |
intersectiesegmente.in /intersectiesegmente.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #15397086 | Utilizator | |
Fișier | intersectiesegmente.cpp | Dimensiune | 1.44 KB |
Data încărcării | 12 Aprilie 2019, 15:18 | Scor / rezultat | Eroare de compilare |
intersectiesegmente.cpp:23:15: error: 'int y1 [4]' redeclared as different kind of symbol int x1[4],y1[4]; ^ In file included from /usr/include/features.h:374:0, from /usr/include/assert.h:35, from /usr/include/c++/4.8/cassert:43, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:33, from intersectiesegmente.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:241:1: error: previous declaration of 'double y1(double)' __MATHCALL (y1,, (_Mdouble_)); ^ intersectiesegmente.cpp: In function 'int main()': intersectiesegmente.cpp:43:30: warning: pointer to a function used in arithmetic [-Wpointer-arith] cin>>x1[i]>>y1[i]; ^ intersectiesegmente.cpp:43:17: error: cannot bind 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>x1[i]>>y1[i]; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from intersectiesegmente.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = double(double)throw ()]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ intersectiesegmente.cpp:49:27: error: no matching function for call to 'get(int [4], double (&)(double)throw ())' triple f=get(x1,y1); ^ intersectiesegmente.cpp:49:27: note: candidates are: intersectiesegmente.cpp:15:8: note: triple get(int*, int*) triple get(int x[],int y[]) ^ intersectiesegmente.cpp:15:8: note: no known conversion for argument 2 from 'double(double)throw ()' to 'int*' 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'std::tuple<_Elements ...>' and 'int [4]' triple f=get(x1,y1); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'const std::tuple<_Elements ...>' and 'int [4]' triple f=get(x1,y1); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'std::tuple<_Elements ...>' and 'int [4]' triple f=get(x1,y1); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'const std::array<_Tp, _Nm>' and 'int [4]' triple f=get(x1,y1); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'std::array<_Tp, _Nm>' and 'int [4]' triple f=get(x1,y1); ^ 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 /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'std::array<_Tp, _Nm>' and 'int [4]' triple f=get(x1,y1); ^ In file included from /usr/include/c++/4.8/algorithm:60:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'const std::pair<_Tp1, _Tp2>' and 'int [4]' triple f=get(x1,y1); ^ In file included from /usr/include/c++/4.8/algorithm:60:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'std::pair<_Tp1, _Tp2>' and 'int [4]' triple f=get(x1,y1); ^ In file included from /usr/include/c++/4.8/algorithm:60:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from intersectiesegmente.cpp:1: /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: intersectiesegmente.cpp:49:27: note: mismatched types 'std::pair<_Tp1, _Tp2>' and 'int [4]' triple f=get(x1,y1); ^ intersectiesegmente.cpp:66:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] if(onsg(x,y,x1[0],y1[0],x1[1],y1[1]) && onsg(x,y,x2[0],y2[0],x2[1],y2[1])) ^ intersectiesegmente.cpp:66:43: warning: pointer to a function used in arithmetic [-Wpointer-arith] if(onsg(x,y,x1[0],y1[0],x1[1],y1[1]) && onsg(x,y,x2[0],y2[0],x2[1],y2[1])) ^ intersectiesegmente.cpp:66:44: error: cannot convert 'double (*)(double)throw ()' to 'double' for argument '4' to 'bool onsg(double, double, double, double, double, double)' if(onsg(x,y,x1[0],y1[0],x1[1],y1[1]) && onsg(x,y,x2[0],y2[0],x2[1],y2[1])) ^ intersectiesegmente.cpp:39:44: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("intersectiesegmente.in","r",stdin); ^ intersectiesegmente.cpp:40:54: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("intersectiesegmente.out","w",stdout); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema IntersectieSegmente 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ă.