#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 | #51886866 | Utilizator | |
Fișier | roboti.cpp | Dimensiune | 1015 B |
Data încărcării | 03 Septembrie 2024, 18:43 | Scor / rezultat | Eroare de compilare |
roboti.cpp:8:1: error: expected ',' or ';' before 'int' int a[1002][1002],v[1000001],w[1000001],n,m,i1,j1,i2,j2,p,u,i,j; ^ roboti.cpp: In function 'int main()': roboti.cpp:13:5: error: reference to 'cin' is ambiguous cin >> n >> m; ^ roboti.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("roboti.in"); ^ In file included from roboti.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ roboti.cpp:13:12: error: 'n' was not declared in this scope cin >> n >> m; ^ roboti.cpp:13:17: error: 'm' was not declared in this scope cin >> n >> m; ^ roboti.cpp:18:13: error: reference to 'cin' is ambiguous cin >> a[i][j]; ^ roboti.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("roboti.in"); ^ In file included from roboti.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ roboti.cpp:18:20: error: 'a' was not declared in this scope cin >> a[i][j]; ^ roboti.cpp:22:5: error: reference to 'cin' is ambiguous cin >> i1 >> j1 >> i2 >> j2; ^ roboti.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("roboti.in"); ^ In file included from roboti.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ roboti.cpp:22:12: error: 'i1' was not declared in this scope cin >> i1 >> j1 >> i2 >> j2; ^ roboti.cpp:22:18: error: 'j1' was not declared in this scope cin >> i1 >> j1 >> i2 >> j2; ^ roboti.cpp:22:24: error: 'i2' was not declared in this scope cin >> i1 >> j1 >> i2 >> j2; ^ roboti.cpp:22:30: error: 'j2' was not declared in this scope cin >> i1 >> j1 >> i2 >> j2; ^ roboti.cpp:24:5: error: 'a' was not declared in this scope a[i1][j1] = 1; ^ roboti.cpp:26:5: error: 'v' was not declared in this scope v[1] = i1, w[1] = j1; ^ roboti.cpp:26:16: error: 'w' was not declared in this scope v[1] = i1, w[1] = j1; ^ roboti.cpp:28:5: error: 'p' was not declared in this scope p = u = 1; ^ roboti.cpp:28:9: error: 'u' was not declared in this scope p = u = 1; ^ roboti.cpp:32:9: error: 'i' was not declared in this scope i = v[p]; ^ roboti.cpp:33:9: error: 'j' was not declared in this scope j = w[p]; ^ roboti.cpp:49:5: error: reference to 'cout' is ambiguous cout << a[i2][j2] - 1; ^ roboti.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("roboti.out") ^ In file included from roboti.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
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ă.