Detalii evaluare #64054734

Rezumat problemă

#4155

Harta unei regiuni este reprezentată într-un sistem de coordonate cartezian și sunt cunoscute coordonatele a n orașe, numerotate de la 1 la n.

Se dorește construirea unor drumuri bidirecționale între anumite perechi de orașe, astfel încât:

  • să se poate ajunge din orice oraș în oricare altul folosind unul sau mai multe dintre drumurile construite;
  • suma lungimilor drumurilor construite să fie minimă.

Să se determine suma lungimilor drumurilor construite.

Detalii

Problema Harta3 Operații I/O harta3.in/harta3.out
Limita timp 0.2 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #64054734 Utilizator Dragos Eric (GigiMustar)
Fișier harta3.cpp Dimensiune 1.20 KB
Data încărcării 14 Aprilie 2026, 15:33 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

harta3.cpp: In function 'void citire()':
harta3.cpp:17:17: warning: unused variable 'c' [-Wunused-variable]
         int x,y,c;

                 ^
harta3.cpp: In function 'void prim()':
harta3.cpp:25:48: error: converting to 'std::priority_queue<std::tuple<double, int, int>, std::vector<std::tuple<double, int, int> >, std::greater<std::tuple<double, int, int> > >::value_type {aka std::tuple<double, int, int>}' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {int, int&, int&}; <template-parameter-2-2> = void; _Elements = {double, int, int}]'
     pq.push({0, nodes[0].first,nodes[0].second});

                                                ^
harta3.cpp:28:14: error: expected unqualified-id before '[' token
         auto [wt, x, y] = pq.top();

              ^
harta3.cpp:30:17: error: 'x' was not declared in this scope
         if(viz[{x,y}] == 1) continue;

                 ^
harta3.cpp:30:19: error: 'y' was not declared in this scope
         if(viz[{x,y}] == 1) continue;

                   ^
harta3.cpp:30:15: error: no match for 'operator[]' (operand types are 'std::map<std::pair<int, int>, bool>' and '<brace-enclosed initializer list>')
         if(viz[{x,y}] == 1) continue;

               ^
harta3.cpp:30:15: note: candidates are:
In file included from /usr/include/c++/4.8/map:61:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80,
                 from harta3.cpp:1:
/usr/include/c++/4.8/bits/stl_map.h:456:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<int, int>; _Tp = bool; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>]
       operator[](const key_type& __k)
       ^
/usr/include/c++/4.8/bits/stl_map.h:456:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/bits/stl_map.h:476:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<int, int>; _Tp = bool; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>]
       operator[](key_type&& __k)
       ^
/usr/include/c++/4.8/bits/stl_map.h:476:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<int, int>, bool>::key_type&& {aka std::pair<int, int>&&}'
harta3.cpp:31:14: error: 'x' was not declared in this scope
         viz[{x,y}] = 1;

              ^
harta3.cpp:31:16: error: 'y' was not declared in this scope
         viz[{x,y}] = 1;

                ^
harta3.cpp:31:12: error: no match for 'operator[]' (operand types are 'std::map<std::pair<int, int>, bool>' and '<brace-enclosed initializer list>')
         viz[{x,y}] = 1;

            ^
harta3.cpp:31:12: note: candidates are:
In file included from /usr/include/c++/4.8/map:61:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80,
                 from harta3.cpp:1:
/usr/include/c++/4.8/bits/stl_map.h:456:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::pair<int, int>; _Tp = bool; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>]
       operator[](const key_type& __k)
       ^
/usr/include/c++/4.8/bits/stl_map.h:456:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/bits/stl_map.h:476:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::pair<int, int>; _Tp = bool; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, bool> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = bool; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<int, int>]
       operator[](key_type&& __k)
       ^
/usr/include/c++/4.8/bits/stl_map.h:476:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::map<std::pair<int, int>, bool>::key_type&& {aka std::pair<int, int>&&}'
harta3.cpp:32:16: error: 'wt' was not declared in this scope
         res += wt;

                ^
harta3.cpp:36:40: error: could not convert '{x, y}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
                 pq.push({cost({x, y}, v), v.first, v.second});

                                        ^
harta3.cpp:36:61: error: no matching function for call to 'std::priority_queue<std::tuple<double, int, int>, std::vector<std::tuple<double, int, int> >, std::greater<std::tuple<double, int, int> > >::push(<brace-enclosed initializer list>)'
                 pq.push({cost({x, y}, v), v.first, v.second});

                                                             ^
harta3.cpp:36:61: note: candidates are:
In file included from /usr/include/c++/4.8/queue:64:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:85,
                 from harta3.cpp:1:
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::tuple<double, int, int>; _Sequence = std::vector<std::tuple<double, int, int> >; _Compare = std::greater<std::tuple<double, int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<double, int, int>]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::tuple<double, int, int>&}'
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::tuple<double, int, int>; _Sequence = std::vector<std::tuple<double, int, int> >; _Compare = std::greater<std::tuple<double, int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<double, int, int>]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::tuple<double, int, int>, std::vector<std::tuple<double, int, int> >, std::greater<std::tuple<double, int, int> > >::value_type&& {aka std::tuple<double, int, int>&&}'

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

Du-te sus!