#3547
vacanta2020
În anul 2020, profitând de lipsa oamenilor de pe şosele, guvernul a construit atâtea şosele încât poţi ajunge din orice oraş al patriei în oricare altul. Drumul dintre două oraşe are şi un cost, cel al benzinei consumate. Dorel s-a hotărât să plece într-o excursie, pornind din oraşul 1
până într-un oraş oarecare. El profită şi de oferta guvernului de relansare a turismului, având k
vouchere de călătorie. Un voucher îl scuteşte de plata benzinei între două oraşe consecutiv vizitate, traseu pe care îl alege el pentru scutirea plăţii, de asemenea nefiind obligatorie folosirea tuturor voucherelor primite. Aflaţi costul minim al călătoriei din oraşul 1
pâna la fiecare oraş.
Problema | vacanta2020 | Operații I/O |
vacanta2020.in /vacanta2020.out
|
---|---|---|---|
Limita timp | 2.5 secunde | Limita memorie |
Total: 256 MB
/
Stivă 128 MB
|
Id soluție | #53180238 | Utilizator | |
Fișier | vacanta2020.cpp | Dimensiune | 2.04 KB |
Data încărcării | 20 Octombrie 2024, 14:54 | Scor / rezultat | Eroare de compilare |
vacanta2020.cpp: In function 'std::vector<int> dijkstra(int, int, std::vector<std::vector<Edge> >&)': vacanta2020.cpp:17:79: error: wrong number of template arguments (0, should be 1) priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<>> pq; ^ In file included from /usr/include/c++/4.8/string:48: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 vacanta2020.cpp:1: /usr/include/c++/4.8/bits/stl_function.h:222:12: error: provided for 'template<class _Tp> struct std::greater' struct greater : public binary_function<_Tp, _Tp, bool> ^ vacanta2020.cpp:17:80: error: template argument 3 is invalid priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<>> pq; ^ vacanta2020.cpp:17:85: error: invalid type in declaration before ';' token priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<>> pq; ^ vacanta2020.cpp:20:8: error: request for member 'push' in 'pq', which is of non-class type 'int' pq.push({0, 1, 0}); // {cost, node, vouchers_used} ^ vacanta2020.cpp:22:16: error: request for member 'empty' in 'pq', which is of non-class type 'int' while (!pq.empty()) { ^ vacanta2020.cpp:23:14: error: expected unqualified-id before '[' token auto [cost, node, vouchers_used] = pq.top(); ^ vacanta2020.cpp:24:12: error: request for member 'pop' in 'pq', which is of non-class type 'int' pq.pop(); ^ vacanta2020.cpp:26:13: error: 'cost' was not declared in this scope if (cost > dist[node][vouchers_used]) continue; ^ vacanta2020.cpp:26:25: error: 'node' was not declared in this scope if (cost > dist[node][vouchers_used]) continue; ^ vacanta2020.cpp:26:31: error: 'vouchers_used' was not declared in this scope if (cost > dist[node][vouchers_used]) continue; ^ vacanta2020.cpp:28:33: error: 'node' was not declared in this scope for (auto& edge : graph[node]) { ^ vacanta2020.cpp:33:33: error: 'vouchers_used' was not declared in this scope if (dist[next_node][vouchers_used] > cost + next_cost) { ^ vacanta2020.cpp:33:50: error: 'cost' was not declared in this scope if (dist[next_node][vouchers_used] > cost + next_cost) { ^ vacanta2020.cpp:35:20: error: request for member 'push' in 'pq', which is of non-class type 'int' pq.push({dist[next_node][vouchers_used], next_node, vouchers_used}); ^ vacanta2020.cpp:39:17: error: 'vouchers_used' was not declared in this scope if (vouchers_used < k && dist[next_node][vouchers_used + 1] > cost) { ^ vacanta2020.cpp:39:75: error: 'cost' was not declared in this scope if (vouchers_used < k && dist[next_node][vouchers_used + 1] > cost) { ^ vacanta2020.cpp:41:20: error: request for member 'push' in 'pq', which is of non-class type 'int' pq.push({dist[next_node][vouchers_used + 1], next_node, vouchers_used + 1}); ^ vacanta2020.cpp:48:64: error: 'min_element' was not declared in this scope result[i] = *min_element(dist[i].begin(), dist[i].end()); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema vacanta2020 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ă.