#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 | #51331388 | Utilizator | |
Fișier | lee.cpp | Dimensiune | 1.56 KB |
Data încărcării | 07 Iunie 2024, 17:38 | Scor / rezultat | Eroare de compilare |
lee.cpp: In function 'int main()': lee.cpp:8:25: error: conflicting declaration 'main()::<anonymous struct> c [3]' struct{int lin,col;}c[3],aux; ^ lee.cpp:7:12: error: 'c' has a previous declaration as 'int c' {int n,a,b,c,d,e,f,i,j; ^ lee.cpp:11:17: error: 'm' was not declared in this scope for(j=1;j<=m;j++) cin>>a[i][j]; ^ lee.cpp:11:32: error: invalid types 'int[int]' for array subscript for(j=1;j<=m;j++) cin>>a[i][j]; ^ lee.cpp:13:11: error: invalid types 'int[int]' for array subscript cin>>c[1].lin>>c[1].col>>c[2].lin>>c[2].col>>c[3].lin>>c[3].col; ^ lee.cpp:13:21: error: invalid types 'int[int]' for array subscript cin>>c[1].lin>>c[1].col>>c[2].lin>>c[2].col>>c[3].lin>>c[3].col; ^ lee.cpp:13:31: error: invalid types 'int[int]' for array subscript cin>>c[1].lin>>c[1].col>>c[2].lin>>c[2].col>>c[3].lin>>c[3].col; ^ lee.cpp:13:41: error: invalid types 'int[int]' for array subscript cin>>c[1].lin>>c[1].col>>c[2].lin>>c[2].col>>c[3].lin>>c[3].col; ^ lee.cpp:13:51: error: invalid types 'int[int]' for array subscript cin>>c[1].lin>>c[1].col>>c[2].lin>>c[2].col>>c[3].lin>>c[3].col; ^ lee.cpp:13:61: error: invalid types 'int[int]' for array subscript cin>>c[1].lin>>c[1].col>>c[2].lin>>c[2].col>>c[3].lin>>c[3].col; ^ lee.cpp:16:30: error: invalid types 'int[int]' for array subscript for(j=2;j<=3;j++) if(c[i].lin>c[i].lin){aux=c[i]; ^ lee.cpp:16:39: error: invalid types 'int[int]' for array subscript for(j=2;j<=3;j++) if(c[i].lin>c[i].lin){aux=c[i]; ^ lee.cpp:16:53: error: invalid types 'int[int]' for array subscript for(j=2;j<=3;j++) if(c[i].lin>c[i].lin){aux=c[i]; ^ lee.cpp:17:49: error: invalid types 'int[int]' for array subscript c[i]=c[j]; ^ lee.cpp:17:54: error: invalid types 'int[int]' for array subscript c[i]=c[j]; ^ lee.cpp:18:49: error: invalid types 'int[int]' for array subscript c[j]=aux; ^ lee.cpp:21:30: error: invalid types 'int[int]' for array subscript for(j=2;j<=3;j++) if(c[i].col>c[j].col){aux=c[i]; ^ lee.cpp:21:39: error: invalid types 'int[int]' for array subscript for(j=2;j<=3;j++) if(c[i].col>c[j].col){aux=c[i]; ^ lee.cpp:21:53: error: invalid types 'int[int]' for array subscript for(j=2;j<=3;j++) if(c[i].col>c[j].col){aux=c[i]; ^ lee.cpp:22:49: error: invalid types 'int[int]' for array subscript c[i]=c[j]; ^ lee.cpp:22:54: error: invalid types 'int[int]' for array subscript c[i]=c[j]; ^ lee.cpp:23:49: error: invalid types 'int[int]' for array subscript c[j]=aux; ^ lee.cpp:25:15: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:24: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:38: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:47: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:61: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:70: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:84: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:93: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:109: error: invalid types 'int[int]' for array subscript cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:124: error: unable to find numeric literal operator 'operator"" col' cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:25:129: error: expected ']' before ')' token cout<<abs(c[1].lin-c[2].lin)+abs(c[1].col-c[2].col)+abs(c[2].lin-c[3].lin)+abs(c[2].col-c[3].col)+abs(1-c[1].lin)+abs(1-c[1.col); ^ lee.cpp:7:10: warning: unused variable 'b' [-Wunused-variable] {int n,a,b,c,d,e,f,i,j; ^ lee.cpp:7:14: warning: unused variable 'd' [-Wunused-variable] {int n,a,b,c,d,e,f,i,j; ^ lee.cpp:7:16: warning: unused variable 'e' [-Wunused-variable] {int n,a,b,c,d,e,f,i,j; ^ lee.cpp:7:18: warning: unused variable 'f' [-Wunused-variable] {int n,a,b,c,d,e,f,i,j; ^
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ă.