#864
Roboti
Se dă o matrice cu n
linii și m
coloane și elemente 0
sau 1
, reprezentând planul unui teren în care 0
reprezintă o zonă accesibilă, iar 1
reprezintă o zonă inaccesibilă. O zonă a terenului are ca și coordonate linia și coloana corespunzătoare din matrice. Într-o zonă cunoscută a matricei se află un robot, iar în altă zonă, e asemenea cunoscută, se află o roboțică. Determinați numărul minim de pași prin care robotul va ajunge la roboțică. Dacă nu este posibil ca robotul să ajungă la roboțică, rezultatul va fi -1
.
Problema | Roboti | Operații I/O |
![]() roboti.in /roboti.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 32 MB
/
Stivă 8 MB
|
Id soluție | #58524753 | Utilizator | |
Fișier | roboti.cpp | Dimensiune | 2.97 KB |
Data încărcării | 14 Iunie 2025, 00:11 | Scor / rezultat | Eroare de compilare |
roboti.cpp:71:5: error: redefinition of 'int n' int n, m; ^ roboti.cpp:6:5: error: 'int n' previously declared here int n, m; ^ roboti.cpp:71:8: error: redefinition of 'int m' int n, m; ^ roboti.cpp:6:8: error: 'int m' previously declared here int n, m; ^ roboti.cpp:72:21: error: redefinition of 'std::vector<std::vector<int> > teren' vector<vector<int>> teren; ^ roboti.cpp:7:21: error: 'std::vector<std::vector<int> > teren' previously declared here vector<vector<int>> teren; ^ roboti.cpp:73:21: error: redefinition of 'std::vector<std::vector<int> > dist' vector<vector<int>> dist; ^ roboti.cpp:8:21: error: 'std::vector<std::vector<int> > dist' previously declared here vector<vector<int>> dist; ^ roboti.cpp:74:5: error: redefinition of 'int start_x' int start_x, start_y, end_x, end_y; ^ roboti.cpp:9:5: error: 'int start_x' previously declared here int start_x, start_y, end_x, end_y; ^ roboti.cpp:74:14: error: redefinition of 'int start_y' int start_x, start_y, end_x, end_y; ^ roboti.cpp:9:14: error: 'int start_y' previously declared here int start_x, start_y, end_x, end_y; ^ roboti.cpp:74:23: error: redefinition of 'int end_x' int start_x, start_y, end_x, end_y; ^ roboti.cpp:9:23: error: 'int end_x' previously declared here int start_x, start_y, end_x, end_y; ^ roboti.cpp:74:30: error: redefinition of 'int end_y' int start_x, start_y, end_x, end_y; ^ roboti.cpp:9:30: error: 'int end_y' previously declared here int start_x, start_y, end_x, end_y; ^ roboti.cpp:77:8: error: redefinition of 'int dx []' int dx[] = {-1, 1, 0, 0}; ^ roboti.cpp:12:5: error: 'int dx [4]' previously defined here int dx[] = {-1, 1, 0, 0}; ^ roboti.cpp:78:8: error: redefinition of 'int dy []' int dy[] = {0, 0, -1, 1}; ^ roboti.cpp:13:5: error: 'int dy [4]' previously defined here int dy[] = {0, 0, -1, 1}; ^ roboti.cpp: In function 'bool valid(int, int)': roboti.cpp:80:6: error: redefinition of 'bool valid(int, int)' bool valid(int x, int y) { ^ roboti.cpp:15:6: error: 'bool valid(int, int)' previously defined here bool valid(int x, int y) { ^ roboti.cpp: In function 'int bfs()': roboti.cpp:84:5: error: redefinition of 'int bfs()' int bfs() { ^ roboti.cpp:19:5: error: 'int bfs()' previously defined here int bfs() { ^ roboti.cpp: In function 'int main()': roboti.cpp:112:5: error: redefinition of 'int main()' int main() { ^ roboti.cpp:47:5: error: 'int main()' previously defined here int main() { ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Roboti 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ă.