#4357
Premierul Marii Britanii, Rishi Sunak, a decis să reorganizeze structura administrativă a comitatului Oxfordshire. În Oxfordshire sunt prezente N
orașe numerotate de la 1
la N
, conectate prin M
autostrăzi (drumuri unidirecționale ce conectează două orașe). Rishi a hotărât ca toate orașele cu proprietatea că cetățenii tuturor celorlalte orașe pot ajunge în ele prin intermediul autostrăzilor să devină reședințe. Deoarece numărul de orașe și autostrăzi din Oxfordshire este foarte mare, Rishi vă cere ajutorul în rezolvarea a două probleme cheie.
1. Care sunt indicii orașelor reședință din Oxfordshire.
2. Care este distanța minimă de la fiecare oraș până la cea mai apropiată reședință de acel oraș.
Info-Oltenia 2023, individual 11-12
Problema | Oxford | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
Id soluție | #56489050 | Utilizator | |
Fișier | oxford.cpp | Dimensiune | 2.56 KB |
Data încărcării | 21 Februarie 2025, 17:24 | Scor / rezultat | Eroare de compilare |
oxford.cpp: In function 'void dfs1(int)': oxford.cpp:20:15: error: expected unqualified-id before '[' token for (auto [next, _] : adj[node]) { ^ oxford.cpp:20:15: error: expected ';' before '[' token oxford.cpp:20:22: error: '_' was not declared in this scope for (auto [next, _] : adj[node]) { ^ oxford.cpp: In lambda function: oxford.cpp:20:25: error: expected '{' before ':' token for (auto [next, _] : adj[node]) { ^ oxford.cpp: In function 'void dfs1(int)': oxford.cpp:20:15: error: overloaded function with no contextual type information for (auto [next, _] : adj[node]) { ^ oxford.cpp:20:25: error: expected ';' before ':' token for (auto [next, _] : adj[node]) { ^ oxford.cpp:20:25: error: expected primary-expression before ':' token oxford.cpp:20:25: error: expected ')' before ':' token oxford.cpp:20:25: error: expected primary-expression before ':' token oxford.cpp:20:25: error: expected ';' before ':' token oxford.cpp: In function 'void dfs2(int, int)': oxford.cpp:29:15: error: expected unqualified-id before '[' token for (auto [next, _] : rev_adj[node]) { ^ oxford.cpp:29:15: error: expected ';' before '[' token oxford.cpp:29:22: error: '_' was not declared in this scope for (auto [next, _] : rev_adj[node]) { ^ oxford.cpp: In lambda function: oxford.cpp:29:25: error: expected '{' before ':' token for (auto [next, _] : rev_adj[node]) { ^ oxford.cpp: In function 'void dfs2(int, int)': oxford.cpp:29:15: error: overloaded function with no contextual type information for (auto [next, _] : rev_adj[node]) { ^ oxford.cpp:29:25: error: expected ';' before ':' token for (auto [next, _] : rev_adj[node]) { ^ oxford.cpp:29:25: error: expected primary-expression before ':' token oxford.cpp:29:25: error: expected ')' before ':' token oxford.cpp:29:25: error: expected primary-expression before ':' token oxford.cpp:29:25: error: expected ';' before ':' token oxford.cpp: In function 'std::vector<int> dijkstra(const std::vector<int>&)': oxford.cpp:36:67: error: wrong number of template arguments (0, should be 1) priority_queue<pair<int, int>, vector<pair<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 oxford.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> ^ oxford.cpp:36:68: error: template argument 3 is invalid priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq; ^ oxford.cpp:36:73: error: invalid type in declaration before ';' token priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq; ^ oxford.cpp:41:12: error: request for member 'emplace' in 'pq', which is of non-class type 'int' pq.emplace(0, src); ^ oxford.cpp:44:16: error: request for member 'empty' in 'pq', which is of non-class type 'int' while (!pq.empty()) { ^ oxford.cpp:45:14: error: expected unqualified-id before '[' token auto [d, node] = pq.top(); ^ oxford.cpp:46:12: error: request for member 'pop' in 'pq', which is of non-class type 'int' pq.pop(); ^ oxford.cpp:48:13: error: 'd' was not declared in this scope if (d > dist[node]) continue; ^ oxford.cpp:48:22: error: 'node' was not declared in this scope if (d > dist[node]) continue; ^ oxford.cpp:50:19: error: expected unqualified-id before '[' token for (auto [next, cost] : adj[node]) { ^ oxford.cpp:50:19: error: expected ';' before '[' token oxford.cpp:50:26: error: 'cost' was not declared in this scope for (auto [next, cost] : adj[node]) { ^ oxford.cpp: In lambda function: oxford.cpp:50:32: error: expected '{' before ':' token for (auto [next, cost] : adj[node]) { ^ oxford.cpp: In function 'std::vector<int> dijkstra(const std::vector<int>&)': oxford.cpp:50:19: error: overloaded function with no contextual type information for (auto [next, cost] : adj[node]) { ^ oxford.cpp:50:32: error: expected ';' before ':' token for (auto [next, cost] : adj[node]) { ^ oxford.cpp:50:32: error: expected primary-expression before ':' token oxford.cpp:50:32: error: expected ')' before ':' token oxford.cpp:50:32: error: expected primary-expression before ':' token oxford.cpp:50:32: error: expected ';' before ':' token oxford.cpp:111:1: error: expected '}' at end of input } ^ oxford.cpp:111:1: error: expected '}' at end of input oxford.cpp:111:1: warning: no return statement in function returning non-void [-Wreturn-type]
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Oxford 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ă.