#3277
Lee
Se consideră o matrice cu N
linii și N
coloane, numerotate de la 1
la N
, care memorează doar valori 0
și 1
. Se dau de asemenea coordonatele a trei componente din această matrice. Să se determine lungimea minimă a unui drum care pleacă din poziția (1,1)
, trece obligatoriu prin cele trei componente date (nu contează în ce ordine) și apoi ajunge în poziția (N, N)
, drum care trece doar prin componente marcate cu 0
și învecinate pe linii și coloane.
Problema | Lee | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58589728 | Utilizator | |
Fișier | lee.cpp | Dimensiune | 1.93 KB |
Data încărcării | 25 Iunie 2025, 19:16 | Scor / rezultat | Eroare de compilare |
lee.cpp:5:36: error: 'int y1' redeclared as different kind of symbol int n, m, k, i, a[1001][1001], x1, y1, x2, y2, x3, y3, d; ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from lee.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:241:1: error: previous declaration of 'double y1(double)' __MATHCALL (y1,, (_Mdouble_)); ^ lee.cpp: In function 'int main()': lee.cpp:63:9: error: cannot bind 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; ^ In file included from /usr/include/c++/4.8/iostream:40:0, from lee.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = double(double)throw ()]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ lee.cpp:65:5: error: 'x' was not declared in this scope x = 1; y = 1; xn = n; yn = n; ^ lee.cpp:65:12: error: 'y' was not declared in this scope x = 1; y = 1; xn = n; yn = n; ^ lee.cpp:65:19: error: 'xn' was not declared in this scope x = 1; y = 1; xn = n; yn = n; ^ lee.cpp:65:30: error: assignment of function 'double yn(int, double)' x = 1; y = 1; xn = n; yn = n; ^ lee.cpp:65:30: error: cannot convert 'int' to 'double(int, double)throw ()' in assignment lee.cpp:67:58: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d1=alg_lee(x, y, x1, y1) + alg_lee(x1, y1, x2, y2) + alg_lee(x2, y2, x3, y3) + alg_lee(x3, y3, xn, yn); ^ lee.cpp:22:5: error: initializing argument 2 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:69:58: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d2=alg_lee(x, y, x1, y1) + alg_lee(x1, y1, x3, y3) + alg_lee(x3, y3, x2, y2) + alg_lee(x2, y2, xn, yn); ^ lee.cpp:22:5: error: initializing argument 2 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:71:58: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d3=alg_lee(x, y, x2, y2) + alg_lee(x2, y2, x1, y1) + alg_lee(x1, y1, x3, y3) + alg_lee(x3, y3, xn, yn); ^ lee.cpp:22:5: error: initializing argument 4 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:71:84: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d3=alg_lee(x, y, x2, y2) + alg_lee(x2, y2, x1, y1) + alg_lee(x1, y1, x3, y3) + alg_lee(x3, y3, xn, yn); ^ lee.cpp:22:5: error: initializing argument 2 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:73:84: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d4=alg_lee(x, y, x2, y2) + alg_lee(x2, y2, x3, y3) + alg_lee(x3, y3, x1, y1) + alg_lee(x1, y1, xn, yn); ^ lee.cpp:22:5: error: initializing argument 4 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:75:58: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d5=alg_lee(x, y, x3, y3) + alg_lee(x3, y3, x1, y1) + alg_lee(x1, y1, x2, y2) + alg_lee(x2, y2, xn, yn); ^ lee.cpp:22:5: error: initializing argument 4 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:75:84: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d5=alg_lee(x, y, x3, y3) + alg_lee(x3, y3, x1, y1) + alg_lee(x1, y1, x2, y2) + alg_lee(x2, y2, xn, yn); ^ lee.cpp:22:5: error: initializing argument 2 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:77:84: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] int d6=alg_lee(x, y, x3, y3) + alg_lee(x3, y3, x2, y2) + alg_lee(x2, y2, x1, y1) + alg_lee(x1, y1, xn, yn); ^ lee.cpp:22:5: error: initializing argument 4 of 'int alg_lee(int, int, int, int)' [-fpermissive] int alg_lee(int x1, int y1, int x2, int y2){ ^ lee.cpp:84:1: error: expected ';' before '}' token } ^ lee.cpp:75:9: warning: unused variable 'd5' [-Wunused-variable] int d5=alg_lee(x, y, x3, y3) + alg_lee(x3, y3, x1, y1) + alg_lee(x1, y1, x2, y2) + alg_lee(x2, y2, xn, yn); ^ lee.cpp:77:9: warning: unused variable 'd6' [-Wunused-variable] int d6=alg_lee(x, y, x3, y3) + alg_lee(x3, y3, x2, y2) + alg_lee(x2, y2, x1, y1) + alg_lee(x1, y1, xn, yn); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Lee 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ă.