#837
Fill
Se dă o matrice cu n
linii și m
coloane și elemente 0
sau 1
, care reprezintă harta unei planete, în care 1
înseamnă uscat, iar 0
înseamnă apă. Două elemente 1
care se învecinează pe linie sau pe coloană (nu și pe diagonală) fac parte din același continent.
Să se determine câte continente sunt pe hartă.
Problema | Fill | Operații I/O |
fill.in /fill.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #40654713 | Utilizator | |
Fișier | fill.cpp | Dimensiune | 841 B |
Data încărcării | 15 Decembrie 2022, 12:00 | Scor / rezultat | Eroare de compilare |
fill.cpp:2:58: error: expected constructor, destructor, or type conversion before ';' token fill(int t[100][100],int a,int b, int i, int j, int &ctr); ^ fill.cpp: In function 'int main()': fill.cpp:5:5: error: 'ifstream' was not declared in this scope ifstream in ("fill.in"); ^ fill.cpp:5:5: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from fill.cpp:1: /usr/include/c++/4.8/iosfwd:157:34: note: 'std::ifstream' typedef basic_ifstream<char> ifstream; ^ fill.cpp:5:14: error: expected ';' before 'in' ifstream in ("fill.in"); ^ fill.cpp:6:5: error: 'ofstream' was not declared in this scope ofstream out ("fill.out"); ^ fill.cpp:6:5: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from fill.cpp:1: /usr/include/c++/4.8/iosfwd:160:34: note: 'std::ofstream' typedef basic_ofstream<char> ofstream; ^ fill.cpp:6:14: error: expected ';' before 'out' ofstream out ("fill.out"); ^ fill.cpp:8:5: error: 'in' was not declared in this scope in>>a>>b; ^ fill.cpp:14:23: error: 'fill' was not declared in this scope fill(t,a,b,0,0,ctr); ^ fill.cpp:14:23: note: suggested alternative: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from fill.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: 'std::fill' fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ fill.cpp: At global scope: fill.cpp:18:57: error: ISO C++ forbids declaration of 'fill' with no type [-fpermissive] fill(int t[100][100],int a,int b, int i, int j, int &ctr){ ^ fill.cpp: In function 'int fill(int (*)[100], int, int, int, int, int&)': fill.cpp:22:46: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int' if(t[i][j+1]==1) fill(t,a,b,i,j+1,t[i][j]-2); ^ fill.cpp:18:1: error: in passing argument 6 of 'int fill(int (*)[100], int, int, int, int, int&)' fill(int t[100][100],int a,int b, int i, int j, int &ctr){ ^ fill.cpp:26:46: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int' if(t[i][j-1]==1) fill(t,a,b,i,j-1,t[i][j]-2); ^ fill.cpp:18:1: error: in passing argument 6 of 'int fill(int (*)[100], int, int, int, int, int&)' fill(int t[100][100],int a,int b, int i, int j, int &ctr){ ^ fill.cpp:27:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(t[i][j-1]==t[i]j[j]) ok=1; ^ fill.cpp:27:23: error: expected ')' before 'j' if(t[i][j-1]==t[i]j[j]) ok=1; ^ fill.cpp:30:46: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int' if(t[i+1][j]==1) fill(t,a,b,i+1,j,t[i][j]-2); ^ fill.cpp:18:1: error: in passing argument 6 of 'int fill(int (*)[100], int, int, int, int, int&)' fill(int t[100][100],int a,int b, int i, int j, int &ctr){ ^ fill.cpp:34:46: error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int' if(t[i-1][j]==1) fill(t,a,b,i-1,j,t[i][j]-2); ^ fill.cpp:18:1: error: in passing argument 6 of 'int fill(int (*)[100], int, int, int, int, int&)' fill(int t[100][100],int a,int b, int i, int j, int &ctr){ ^ fill.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Fill 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ă.