#4411
Se dă un graf orientat cu n
noduri și m
muchii. Fiecare muchie are costul 1
(poate fi parcursă într-un minut). Doi “prieteni” (veri) pornesc din nodul S
. Unul dintre ei vrea să ajungă în nodul A
, iar celălalt vrea să ajungă în nodul B
. Care este numărul minim de minute necesar, astfel încât să fie posibil ca amândoi să ajungă la destinațiile lor, în timpul alocat, în A
, respectiv B
?
OJI 2023, clasele XI-XII
Problema | veri | Operații I/O |
![]() veri.in /veri.out
|
---|---|---|---|
Limita timp | 1.6 secunde | Limita memorie |
Total: 256 MB
/
Stivă 256 MB
|
Id soluție | #57019699 | Utilizator | |
Fișier | veri.cpp | Dimensiune | 5.02 KB |
Data încărcării | 13 Martie 2025, 10:42 | Scor / rezultat | Eroare de compilare |
veri.cpp: In function 'std::pair<long long int, long long int> shortestCycle()': veri.cpp:23:18: error: expected unqualified-id before '[' token auto [node, depth] = q.front(); ^ veri.cpp:25:35: error: 'node' was not declared in this scope for(int neighbour : v[node]){ ^ veri.cpp:27:39: error: 'depth' was not declared in this scope dist[neighbour] = depth + 1; ^ veri.cpp:28:48: error: no matching function for call to 'std::queue<std::pair<long long int, long long int> >::push(<brace-enclosed initializer list>)' q.push({neighbour, depth+1}); ^ veri.cpp:28:48: 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 veri.cpp:1: /usr/include/c++/4.8/bits/stl_queue.h:212:7: note: void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<long long int, long long int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:212:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<long long int, long long int>&}' /usr/include/c++/4.8/bits/stl_queue.h:217:7: note: void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<long long int, long long int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:217:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<long long int, long long int> >::value_type&& {aka std::pair<long long int, long long int>&&}' veri.cpp: In function 'int main()': veri.cpp:172:10: error: expected unqualified-id before '[' token auto [distA, drumA] = bfs(t, a); ^ veri.cpp:173:10: error: expected unqualified-id before '[' token auto [distB, drumB] = bfs(t, b); ^ veri.cpp:176:22: error: 'distA' was not declared in this scope g << max(t + distA, t + distB); ^ veri.cpp:176:33: error: 'distB' was not declared in this scope g << max(t + distA, t + distB); ^ veri.cpp:183:14: error: 'distA' was not declared in this scope g << distA << "\n"; ^ veri.cpp:184:21: error: 'drumA' was not declared in this scope for(int x : drumA){ ^ veri.cpp:188:14: error: 'distB' was not declared in this scope g << distB << "\n"; ^ veri.cpp:189:21: error: 'drumB' was not declared in this scope for(int x : drumB){ ^ veri.cpp:170:9: warning: unused variable 'distT' [-Wunused-variable] int distT = x.first.second; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema veri 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ă.