#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 | #64333902 | Utilizator | |
| Fișier | terencasa_low.cpp | Dimensiune | 677 B |
| Data încărcării | 30 Aprilie 2026, 10:21 | Scor/rezultat | Eroare de compilare |
terencasa_low.cpp:4:11: error: variable ‘std::ifstream f’ has initializer but incomplete type 4 | ifstream f("terencasa_low.in"); | ^ terencasa_low.cpp:5:11: error: variable ‘std::ofstream g’ has initializer but incomplete type 5 | ofstream g("terencasa_low.out"); | ^ terencasa_low.cpp:6:53: error: ‘long long int j1’ redeclared as different kind of entity 6 | long long n,i,j,s[1001][1001],a[1001][1001],m,i1,i2,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:1: /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:16:27: error: assignment of function ‘double j1(double)’ 16 | for(i1=1;i1<=n;i1++)for(j1=1;j1<=m;j1++) | ~~^~ terencasa_low.cpp:16:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | for(i1=1;i1<=n;i1++)for(j1=1;j1<=m;j1++) | ~~^~~ terencasa_low.cpp:16:36: warning: ISO C++ forbids incrementing a pointer of type ‘double (*)(double) noexcept’ {aka ‘double (*)(double)’} [-Wpointer-arith] 16 | for(i1=1;i1<=n;i1++)for(j1=1;j1<=m;j1++) | ^~ terencasa_low.cpp:16:36: error: lvalue required as increment operand terencasa_low.cpp:18:4: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ^~~ terencasa_low.cpp:18:33: warning: pointer to a function used in arithmetic [-Wpointer-arith] 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ~~^~ terencasa_low.cpp:18:30: error: invalid types ‘long long int [1001][double (*)(double) noexcept {aka double (*)(double)}]’ for array subscript 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ^ terencasa_low.cpp:18:74: warning: pointer to a function used in arithmetic [-Wpointer-arith] 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ~~^~ terencasa_low.cpp:18:71: error: invalid types ‘long long int [1001][double (*)(double) noexcept {aka double (*)(double)}]’ for array subscript 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ^ terencasa_low.cpp:18:81: error: invalid operands of types ‘long long int’ and ‘double(double) noexcept’ {aka ‘double(double)’} to binary ‘operator-’ 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ~~^~~ | | | | | double(double) noexcept {aka double(double)} | long long int terencasa_low.cpp:19:1: error: expected primary-expression before ‘if’ 19 | if(sqrt(s[i2][j2]-s[i1-1][j1-1])>sm) | ^~ terencasa_low.cpp:18:92: error: expected ‘)’ before ‘if’ 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ~ ^ | ) 19 | if(sqrt(s[i2][j2]-s[i1-1][j1-1])>sm) | ~~ terencasa_low.cpp:18:1: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 18 | if(int(sqrt(s[i2][j2]-s[i1-1][j1-1]))=sqrt(s[i2][j2]=s[i2][j2]-s[i1-1][j1-1]&&j2-j1=i2-i1); | ^~ terencasa_low.cpp:29:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 29 | return 0; | ^~~~~~
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ă.