Detalii evaluare #38140327

Rezumat problemă

#19 BFS

Se consideră un graf neorientat cu n vârfuri și m muchii și un vârf cunoscut X. Să se afişeze vârfurile vizitate în urma parcurgerii în lățime a grafului pornind din vârful X.

Detalii

Problema BFS Operații I/O BFS.in/BFS.out
Limita timp 1 secunde Limita memorie Total: 128 MB / Stivă 8 MB
Id soluție #38140327 Utilizator Gramescu Andrei (andrei_gramescu)
Fișier bfs.cpp Dimensiune 1.70 KB
Data încărcării 30 Septembrie 2022, 20:24 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from bfs.cpp:5:
/usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]':
/usr/include/c++/4.8/bits/stl_algo.h:2211:62:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:5462:47:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
bfs.cpp:17:74:   required from here
/usr/include/c++/4.8/bits/stl_algo.h:2142:17: error: assignment of read-only location '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()'
        *__first = _GLIBCXX_MOVE(__val);
                 ^
In file included from /usr/include/c++/4.8/queue:62:0,
                 from bfs.cpp:2:
/usr/include/c++/4.8/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]':
/usr/include/c++/4.8/bits/stl_algo.h:1936:42:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:5308:51:   required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:2310:60:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Size = int]'
/usr/include/c++/4.8/bits/stl_algo.h:5461:36:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
bfs.cpp:17:74:   required from here
/usr/include/c++/4.8/bits/stl_heap.h:262:17: error: assignment of read-only location '__result.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()'
       *__result = _GLIBCXX_MOVE(*__first);
                 ^
/usr/include/c++/4.8/bits/stl_heap.h: In instantiation of 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Distance = int; _Tp = int]':
/usr/include/c++/4.8/bits/stl_heap.h:407:71:   required from 'void std::make_heap(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:1933:39:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:5308:51:   required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:2310:60:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Size = int]'
/usr/include/c++/4.8/bits/stl_algo.h:5461:36:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
bfs.cpp:17:74:   required from here
/usr/include/c++/4.8/bits/stl_heap.h:237:29: error: assignment of read-only location '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+<const int*, std::vector<int> >((*(const difference_type*)(& __holeIndex))).__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()'
    *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));
                             ^
/usr/include/c++/4.8/bits/stl_heap.h:243:29: error: assignment of read-only location '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+<const int*, std::vector<int> >((*(const difference_type*)(& __holeIndex))).__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()'
    *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first
                             ^
In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bfs.cpp:1:
/usr/include/c++/4.8/bits/move.h: In instantiation of 'void std::swap(_Tp&, _Tp&) [with _Tp = const int]':
/usr/include/c++/4.8/bits/stl_algobase.h:147:22:   required from 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _ForwardIterator2 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:88:34:   required from 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:2282:74:   required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:2315:54:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _Size = int]'
/usr/include/c++/4.8/bits/stl_algo.h:5461:36:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
bfs.cpp:17:74:   required from here
/usr/include/c++/4.8/bits/move.h:176:11: error: assignment of read-only reference '__a'
       __a = _GLIBCXX_MOVE(__b);
           ^
/usr/include/c++/4.8/bits/move.h:177:11: error: assignment of read-only reference '__b'
       __b = _GLIBCXX_MOVE(__tmp);
           ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/istream:38,
                 from /usr/include/c++/4.8/fstream:38,
                 from bfs.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h: In instantiation of '_BI2 std::__copy_move_backward_a(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = const int*; _BI2 = const int*]':
/usr/include/c++/4.8/bits/stl_algobase.h:596:33:   required from '_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _BI2 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algobase.h:667:15:   required from '_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _BI2 = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:2141:8:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:2211:62:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
/usr/include/c++/4.8/bits/stl_algo.h:5462:47:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >]'
bfs.cpp:17:74:   required from here
/usr/include/c++/4.8/bits/stl_algobase.h:587:18: error: no matching function for call to 'std::__copy_move_backward<true, true, std::random_access_iterator_tag>::__copy_move_b(const int*&, const int*&, const int*&)'
          __result);
                  ^
/usr/include/c++/4.8/bits/stl_algobase.h:587:18: note: candidate is:
/usr/include/c++/4.8/bits/stl_algobase.h:563:9: note: template<class _Tp> static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = _Tp; bool _IsMove = true]
         __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
         ^
/usr/include/c++/4.8/bits/stl_algobase.h:563:9: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/stl_algobase.h:587:18: note:   deduced conflicting types for parameter '_Tp' ('int' and 'const int')
          __result);
                  ^

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