#1622
Arhipelagul Zopopan este format din n
insule de formă triunghiulară numerotate de la 1
la n
. Fiecare insulă este localizată prin coordonatele carteziene ale vârfurilor.
Administrația dorește să cumpere elicoptere pentru a realiza transportul între insule. Un elicopter va putea să asigure o rută între două insule pe distanța minimă obținută pe orizontală sau verticală (paralel cu axele de coordonate). În plus, datorită capacității rezervorului o astfel de rută nu poate să depășească o valoare k
– număr natural. Elicopterele parcurg rutele în ambele sensuri.
Investiția trebuie să îndeplinească următoarele condiții:
Să se scrie un program care pentru n
, k
şi coordonatele vârfurilor insulelor cunoscute, determină:
OJI 2016, Clasele XI-XII
Problema | Elicoptere | Operații I/O |
![]() elicoptere.in /elicoptere.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 4 MB
/
Stivă 4 MB
|
Id soluție | #56939019 | Utilizator | |
Fișier | elicoptere.cpp | Dimensiune | 1.34 KB |
Data încărcării | 11 Martie 2025, 11:50 | Scor / rezultat | Eroare de compilare |
elicoptere.cpp:24:18: error: expected identifier before numeric constant vector<pct>v(3); ^ elicoptere.cpp:24:18: error: expected ',' or '...' before numeric constant elicoptere.cpp: In function 'void comp(int&, int&, int&, triangle&, triangle&, std::vector<edge>&)': elicoptere.cpp:38:13: error: 'struct triangle' has no member named 'a' s1= {t1.a.x,t1.a.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:38:20: error: 'struct triangle' has no member named 'a' s1= {t1.a.x,t1.a.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:38:27: error: 'struct triangle' has no member named 'b' s1= {t1.a.x,t1.a.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:38:34: error: 'struct triangle' has no member named 'b' s1= {t1.a.x,t1.a.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:38:7: error: no match for 'operator=' (operand types are 'segment' and '<brace-enclosed initializer list>') s1= {t1.a.x,t1.a.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:38:7: note: candidates are: elicoptere.cpp:13:8: note: segment& segment::operator=(const segment&) struct segment ^ elicoptere.cpp:13:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const segment&' elicoptere.cpp:13:8: note: segment& segment::operator=(segment&&) elicoptere.cpp:13:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'segment&&' elicoptere.cpp:39:13: error: 'struct triangle' has no member named 'a' s2= {t1.a.x,t1.a.y,t1.c.x,t1.c.y}; ^ elicoptere.cpp:39:20: error: 'struct triangle' has no member named 'a' s2= {t1.a.x,t1.a.y,t1.c.x,t1.c.y}; ^ elicoptere.cpp:39:27: error: 'struct triangle' has no member named 'c' s2= {t1.a.x,t1.a.y,t1.c.x,t1.c.y}; ^ elicoptere.cpp:39:34: error: 'struct triangle' has no member named 'c' s2= {t1.a.x,t1.a.y,t1.c.x,t1.c.y}; ^ elicoptere.cpp:39:7: error: no match for 'operator=' (operand types are 'segment' and '<brace-enclosed initializer list>') s2= {t1.a.x,t1.a.y,t1.c.x,t1.c.y}; ^ elicoptere.cpp:39:7: note: candidates are: elicoptere.cpp:13:8: note: segment& segment::operator=(const segment&) struct segment ^ elicoptere.cpp:13:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const segment&' elicoptere.cpp:13:8: note: segment& segment::operator=(segment&&) elicoptere.cpp:13:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'segment&&' elicoptere.cpp:40:13: error: 'struct triangle' has no member named 'c' s2= {t1.c.x,t1.c.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:40:20: error: 'struct triangle' has no member named 'c' s2= {t1.c.x,t1.c.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:40:27: error: 'struct triangle' has no member named 'b' s2= {t1.c.x,t1.c.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:40:34: error: 'struct triangle' has no member named 'b' s2= {t1.c.x,t1.c.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:40:7: error: no match for 'operator=' (operand types are 'segment' and '<brace-enclosed initializer list>') s2= {t1.c.x,t1.c.y,t1.b.x,t1.b.y}; ^ elicoptere.cpp:40:7: note: candidates are: elicoptere.cpp:13:8: note: segment& segment::operator=(const segment&) struct segment ^ elicoptere.cpp:13:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const segment&' elicoptere.cpp:13:8: note: segment& segment::operator=(segment&&) elicoptere.cpp:13:8: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'segment&&' elicoptere.cpp:45:22: error: invalid initialization of reference of type 'std::vector<pct> (triangle::*&&)(int)' from expression of type '<unresolved overloaded function type>' for(pct punct:t2.v) ^ elicoptere.cpp:45:22: error: no matching function for call to 'begin(std::vector<pct> (triangle::*&)(int))' elicoptere.cpp:45:22: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from elicoptere.cpp:1: /usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>) begin(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed: elicoptere.cpp:45:22: note: 'std::vector<pct> (triangle::*)(int)' is not derived from 'std::initializer_list<_Tp>' for(pct punct:t2.v) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from elicoptere.cpp:1: /usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm]) begin(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed: elicoptere.cpp:45:22: note: mismatched types '_Tp [_Nm]' and 'std::vector<pct> (triangle::*)(int)' for(pct punct:t2.v) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from elicoptere.cpp:1: /usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) begin(const _Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::vector<pct> (triangle::*)(int)]': elicoptere.cpp:45:22: required from here /usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'std::vector<pct> (triangle::* const)(int)' /usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&) begin(_Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::vector<pct> (triangle::*)(int)]': elicoptere.cpp:45:22: required from here /usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'std::vector<pct> (triangle::*)(int)' elicoptere.cpp:45:22: error: no matching function for call to 'end(std::vector<pct> (triangle::*&)(int))' for(pct punct:t2.v) ^ elicoptere.cpp:45:22: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from elicoptere.cpp:1: /usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>) end(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed: elicoptere.cpp:45:22: note: 'std::vector<pct> (triangle::*)(int)' is not derived from 'std::initializer_list<_Tp>' for(pct punct:t2.v) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from elicoptere.cpp:1: /usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm]) end(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed: elicoptere.cpp:45:22: note: mismatched types '_Tp [_Nm]' and 'std::vector<pct> (triangle::*)(int)' for(pct punct:t2.v) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from elicoptere.cpp:1: /usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&) end(const _Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = std::vector<pct> (triangle::*)(int)]': elicoptere.cpp:45:22: required from here /usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'std::vector<pct> (triangle::* const)(int)' /usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&) end(_Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = std::vector<pct> (triangle::*)(int)]': elicoptere.cpp:45:22: required from here /usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'std::vector<pct> (triangle::*)(int)' elicoptere.cpp:47:24: error: 'p' was not declared in this scope if(intersectie(p.x,s1.x1,s1.x2)); ^ elicoptere.cpp:48:24: error: 'p' was not declared in this scope if(intersectie(p.x,s2.x1,s2.x2)); ^ elicoptere.cpp:49:24: error: 'p' was not declared in this scope if(intersectie(p.x,s3.x1,s3.x2)); ^ elicoptere.cpp:45:13: warning: unused variable 'punct' [-Wunused-variable] for(pct punct:t2.v) ^ elicoptere.cpp: In function 'int main()': elicoptere.cpp:60:40: error: invalid types '<unresolved overloaded function type>[int]' for array subscript for(j=0; j<3; ++j)fin>>p[i].v[j].x>>p[i].v[j].y; ^ elicoptere.cpp:60:53: error: invalid types '<unresolved overloaded function type>[int]' for array subscript for(j=0; j<3; ++j)fin>>p[i].v[j].x>>p[i].v[j].y; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Elicoptere 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ă.