#3475
Gigel, un personaj cunoscut, vrea de data aceasta să își construiască o casă. Astfel, el cumpără un teren, reprezentat sub forma unei matrice binare cu n linii și m coloane, dar datorită lipsei de experiență în tranzacții imobiliare este păcălit, deoarece există pe teren zone afectate în care nu se poate construi, marcate în matrice cu 0. Celelalte zone în care se poate construi sunt marcate cu 1.
Gigel acceptă că a greșit și nu are altceva de făcut decât să își construiască casa unde este posibil. Acesta caută pe terenul achiziționat o bucată de teren pătrată de dimensiune cât mai mare, pentru care toate zonele ce o alcătuiesc să fie utilizabile(marcate cu 1 în matricea binară a reprezentării terenului), în care își va construi casa.
Acesta nu se descurcă singur și vă roagă pe voi să îl ajutați să își rezolve această problemă.
| Problema | TerenCasa_low | Operații I/O |
terencasa_low.in/terencasa_low.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64333921 | Utilizator | |
| Fișier | terencasa_low.cpp | Dimensiune | 708 B |
| Data încărcării | 30 Aprilie 2026, 10:22 | Scor/rezultat | Eroare de compilare |
terencasa_low.cpp:5:12: error: variable ‘std::ifstream in’ has initializer but incomplete type 5 | ifstream in("terencasa_low.in"); | ^ terencasa_low.cpp:6:13: error: variable ‘std::ofstream out’ has initializer but incomplete type 6 | ofstream out("terencasa_low.out"); | ^ terencasa_low.cpp:7:47: error: ‘int j1’ redeclared as different kind of entity 7 | int a[1001][1001],s[1001][1001],i,j,i1,i2,m,n,j1,j2,p,q,r,t,l; | ^~ In file included from /usr/include/features.h:502, from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679, from /usr/include/c++/13/bits/requires_hosted.h:31, from /usr/include/c++/13/iostream:38, from terencasa_low.cpp:2: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration ‘double j1(double)’ 221 | __MATHCALL (j1,, (_Mdouble_)); | ^~~~~~~~~~ terencasa_low.cpp: In function ‘int main()’: terencasa_low.cpp:17:9: error: assignment of function ‘double j1(double)’ 17 | for(j1=1;j1<=m;j1++) | ~~^~ terencasa_low.cpp:17:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 17 | for(j1=1;j1<=m;j1++) | ~~^~~ terencasa_low.cpp:17:18: warning: ISO C++ forbids incrementing a pointer of type ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} [-Wpointer-arith] 17 | for(j1=1;j1<=m;j1++) | ^~ terencasa_low.cpp:17:18: error: lvalue required as increment operand terencasa_low.cpp:20:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 20 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]-s[i1-1][j1-1])&&j2-j1=i2-i1); | ~~^~ terencasa_low.cpp:20:32: error: invalid types ‘int [1001][double (*)(double) noexcept {aka double (*)(double)}]’ for array subscript 20 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]-s[i1-1][j1-1])&&j2-j1=i2-i1); | ^ terencasa_low.cpp:20:66: warning: pointer to a function used in arithmetic [-Wpointer-arith] 20 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]-s[i1-1][j1-1])&&j2-j1=i2-i1); | ~~^~ terencasa_low.cpp:20:63: error: invalid types ‘int [1001][double (*)(double) noexcept {aka double (*)(double)}]’ for array subscript 20 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]-s[i1-1][j1-1])&&j2-j1=i2-i1); | ^ terencasa_low.cpp:20:74: error: invalid operands of types ‘int’ and ‘double(double) noexcept’ {aka ‘double(double)’} to binary ‘operator-’ 20 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]-s[i1-1][j1-1])&&j2-j1=i2-i1); | ~~^~~ | | | | | double(double) noexcept {aka double(double)} | int terencasa_low.cpp:21:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 21 | if(sqrt(s[i2][j2]-s[i1-1][j1-1])>sm) | ~~^~ terencasa_low.cpp:21:28: error: invalid types ‘int [1001][double (*)(double) noexcept {aka double (*)(double)}]’ for array subscript 21 | if(sqrt(s[i2][j2]-s[i1-1][j1-1])>sm) | ^ terencasa_low.cpp:21:36: error: ‘sm’ was not declared in this scope; did you mean ‘tm’? 21 | if(sqrt(s[i2][j2]-s[i1-1][j1-1])>sm) | ^~ | tm terencasa_low.cpp:22:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 22 | { sm=sqrt(s[i2][j2]-s[i1-1][j1-1]); | ~~^~ terencasa_low.cpp:22:29: error: invalid types ‘int [1001][double (*)(double) noexcept {aka double (*)(double)}]’ for array subscript 22 | { sm=sqrt(s[i2][j2]-s[i1-1][j1-1]); | ^ terencasa_low.cpp:23:7: error: invalid operands of types ‘int’ and ‘double(double) noexcept’ {aka ‘double(double)’} to binary ‘operator-’ 23 | l=j2-j1+1; | ~~^~~ | | | | | double(double) noexcept {aka double(double)} | int terencasa_low.cpp:25:5: error: invalid conversion from ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} to ‘int’ [-fpermissive] 25 | q=j1; | ^~ | | | double (*)(double) noexcept {aka double (*)(double)}
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema TerenCasa_low 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ă.