Detalii evaluare #53480294

Rezumat problemă

Se dau N segmente în plan, fiecare fiind paralel cu una dintre axele de coordonate. Determinați numărul total de puncte de intersecție între două segmente.

Detalii

Problema Intersectie Segmente Operații I/O is.in/is.out
Limita timp 0.3 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #53480294 Utilizator Galatan Constantin (tucu)
Fișier intersectie_segmente.cpp Dimensiune 2.64 KB
Data încărcării 02 Noiembrie 2024, 05:53 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

intersectie_segmente.cpp: In function 'int main()':
intersectie_segmente.cpp:73:15: error: expected unqualified-id before '[' token
     for (auto [x, y1, y2, sgn] : events)

               ^
intersectie_segmente.cpp:73:15: error: expected ';' before '[' token
intersectie_segmente.cpp:73:16: error: 'x' was not declared in this scope
     for (auto [x, y1, y2, sgn] : events)

                ^
intersectie_segmente.cpp:73:27: error: 'sgn' was not declared in this scope
     for (auto [x, y1, y2, sgn] : events)

                           ^
intersectie_segmente.cpp: In lambda function:
intersectie_segmente.cpp:73:32: error: expected '{' before ':' token
     for (auto [x, y1, y2, sgn] : events)

                                ^
intersectie_segmente.cpp: In function 'int main()':
intersectie_segmente.cpp:73:32: error: could not convert '<lambda closure object>main()::__lambda0{y1, y2}' from 'main()::__lambda0' to 'bool'
intersectie_segmente.cpp:73:32: error: expected ';' before ':' token
intersectie_segmente.cpp:73:32: error: expected primary-expression before ':' token
intersectie_segmente.cpp:73:32: error: expected ')' before ':' token
intersectie_segmente.cpp:73:32: error: expected primary-expression before ':' token
intersectie_segmente.cpp:73:32: error: expected ';' before ':' token
intersectie_segmente.cpp:76:3: error: 'else' without a previous 'if'
   else

   ^
intersectie_segmente.cpp:77:42: error: 'sgn' was not declared in this scope
      Update(1, 0, 2 * MAX_X, y1 + MAX_X, sgn); // introduce (sgn = +1) sau scoate (sgn = -1) un capat de segm orizontal in arbore 

                                          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/c++allocator.h:33:0,
                 from /usr/include/c++/4.8/bits/allocator.h:46,
                 from /usr/include/c++/4.8/string:41,
                 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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from intersectie_segmente.cpp:1:
/usr/include/c++/4.8/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = Event; _Args = {int&, int&, int, int}; _Tp = Event]':
/usr/include/c++/4.8/bits/alloc_traits.h:254:4:   required from 'static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = Event; _Args = {int&, int&, int, int}; _Alloc = std::allocator<Event>; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]'
/usr/include/c++/4.8/bits/alloc_traits.h:393:57:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = Event; _Args = {int&, int&, int, int}; _Alloc = std::allocator<Event>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
/usr/include/c++/4.8/bits/vector.tcc:97:40:   required from 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, int&, int, int}; _Tp = Event; _Alloc = std::allocator<Event>]'
intersectie_segmente.cpp:63:36:   required from here
/usr/include/c++/4.8/ext/new_allocator.h:120:4: error: new initializer expression list treated as compound expression [-fpermissive]
  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
    ^
/usr/include/c++/4.8/ext/new_allocator.h:120:4: error: no matching function for call to 'Event::Event(int)'
/usr/include/c++/4.8/ext/new_allocator.h:120:4: note: candidates are:
intersectie_segmente.cpp:12:8: note: Event::Event()
 struct Event {

        ^
intersectie_segmente.cpp:12:8: note:   candidate expects 0 arguments, 1 provided
intersectie_segmente.cpp:12:8: note: constexpr Event::Event(const Event&)
intersectie_segmente.cpp:12:8: note:   no known conversion for argument 1 from 'int' to 'const Event&'
intersectie_segmente.cpp:12:8: note: constexpr Event::Event(Event&&)
intersectie_segmente.cpp:12:8: note:   no known conversion for argument 1 from 'int' to 'Event&&'
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/c++allocator.h:33:0,
                 from /usr/include/c++/4.8/bits/allocator.h:46,
                 from /usr/include/c++/4.8/string:41,
                 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/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from intersectie_segmente.cpp:1:
/usr/include/c++/4.8/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = Event; _Args = {int&, int&, int&, int}; _Tp = Event]':
/usr/include/c++/4.8/bits/alloc_traits.h:254:4:   required from 'static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = Event; _Args = {int&, int&, int&, int}; _Alloc = std::allocator<Event>; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]'
/usr/include/c++/4.8/bits/alloc_traits.h:393:57:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = Event; _Args = {int&, int&, int&, int}; _Alloc = std::allocator<Event>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
/usr/include/c++/4.8/bits/vector.tcc:97:40:   required from 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, int&, int&, int}; _Tp = Event; _Alloc = std::allocator<Event>]'
intersectie_segmente.cpp:68:38:   required from here
/usr/include/c++/4.8/ext/new_allocator.h:120:4: error: new initializer expression list treated as compound expression [-fpermissive]
  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
    ^
/usr/include/c++/4.8/ext/new_allocator.h:120:4: error: no matching function for call to 'Event::Event(int)'
/usr/include/c++/4.8/ext/new_allocator.h:120:4: note: candidates are:
intersectie_segmente.cpp:12:8: note: Event::Event()
 struct Event {

        ^
intersectie_segmente.cpp:12:8: note:   candidate expects 0 arguments, 1 provided
intersectie_segmente.cpp:12:8: note: constexpr Event::Event(const Event&)
intersectie_segmente.cpp:12:8: note:   no known conversion for argument 1 from 'int' to 'const Event&'
intersectie_segmente.cpp:12:8: note: constexpr Event::Event(Event&&)
intersectie_segmente.cpp:12:8: note:   no known conversion for argument 1 from 'int' to 'Event&&'

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