#837
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 | #64108135 | Utilizator | |
| Fișier | fill.cpp | Dimensiune | 1.24 KB |
| Data încărcării | 17 Aprilie 2026, 12:11 | Scor/rezultat | Eroare de compilare |
fill.cpp:7:1: error: expected ‘,’ or ‘;’ before ‘int’ 7 | int maxp,maxi,nr; | ^~~ fill.cpp: In function ‘void fill()’: fill.cpp:10:5: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 10 | nr++; | ^~ | n fill.cpp:11:7: error: ‘x’ was not declared in this scope 11 | a[x][y]=0; | ^ fill.cpp:11:10: error: ‘y’ was not declared in this scope 11 | a[x][y]=0; | ^ fill.cpp:16:11: error: no matching function for call to ‘fill(int&, int&)’ 16 | fill(vx,vy); | ~~~~^~~~~~~ In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/istream:40, from /usr/include/c++/13/fstream:40, from fill.cpp:1: /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: candidate: ‘template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)’ 1000 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) | ^~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: template argument deduction/substitution failed: fill.cpp:16:11: note: candidate expects 3 arguments, 2 provided 16 | fill(vx,vy); | ~~~~^~~~~~~ fill.cpp:8:6: note: candidate: ‘void fill()’ 8 | void fill() | ^~~~ fill.cpp:8:6: note: candidate expects 0 arguments, 2 provided fill.cpp: In function ‘int main()’: fill.cpp:21:5: error: reference to ‘cin’ is ambiguous 21 | cin>>n>>m; | ^~~ In file included from fill.cpp:2: /usr/include/c++/13/iostream:62:18: note: candidates are: ‘std::istream std::cin’ 62 | extern istream cin; ///< Linked to standard input | ^~~ fill.cpp:4:10: note: ‘std::ifstream cin’ 4 | ifstream cin("lac_x.in"); | ^~~ fill.cpp:24:7: error: reference to ‘cin’ is ambiguous 24 | cin>>a[i][j]; | ^~~ /usr/include/c++/13/iostream:62:18: note: candidates are: ‘std::istream std::cin’ 62 | extern istream cin; ///< Linked to standard input | ^~~ fill.cpp:4:10: note: ‘std::ifstream cin’ 4 | ifstream cin("lac_x.in"); | ^~~ fill.cpp:23:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 23 | for(int j=1;j<=m;j++) | ^~~ fill.cpp:25:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 25 | for(int i=1;i<=m;i++) | ^~~ fill.cpp:29:15: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 29 | nr=0; | ^~ | n fill.cpp:30:19: error: no matching function for call to ‘fill(int&, int&)’ 30 | fill(n,i); | ~~~~^~~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: candidate: ‘template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)’ 1000 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) | ^~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: template argument deduction/substitution failed: fill.cpp:30:19: note: candidate expects 3 arguments, 2 provided 30 | fill(n,i); | ~~~~^~~~~ fill.cpp:8:6: note: candidate: ‘void fill()’ 8 | void fill() | ^~~~ fill.cpp:8:6: note: candidate expects 0 arguments, 2 provided fill.cpp:31:21: error: ‘maxp’ was not declared in this scope 31 | if(nr>maxp) | ^~~~ fill.cpp:39:15: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 39 | nr=0; | ^~ | n fill.cpp:40:19: error: no matching function for call to ‘fill(int&, int)’ 40 | fill(i,1); | ~~~~^~~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: candidate: ‘template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)’ 1000 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) | ^~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: template argument deduction/substitution failed: fill.cpp:40:19: note: candidate expects 3 arguments, 2 provided 40 | fill(i,1); | ~~~~^~~~~ fill.cpp:8:6: note: candidate: ‘void fill()’ 8 | void fill() | ^~~~ fill.cpp:8:6: note: candidate expects 0 arguments, 2 provided fill.cpp:41:21: error: ‘maxp’ was not declared in this scope 41 | if(nr>maxp) | ^~~~ fill.cpp:46:15: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 46 | nr=0; | ^~ | n fill.cpp:47:19: error: no matching function for call to ‘fill(int&, int&)’ 47 | fill(i,m); | ~~~~^~~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: candidate: ‘template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)’ 1000 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) | ^~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: template argument deduction/substitution failed: fill.cpp:47:19: note: candidate expects 3 arguments, 2 provided 47 | fill(i,m); | ~~~~^~~~~ fill.cpp:8:6: note: candidate: ‘void fill()’ 8 | void fill() | ^~~~ fill.cpp:8:6: note: candidate expects 0 arguments, 2 provided fill.cpp:48:21: error: ‘maxp’ was not declared in this scope 48 | if(nr>maxp) | ^~~~ fill.cpp:56:11: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 56 | nr=0; | ^~ | n fill.cpp:57:15: error: no matching function for call to ‘fill(int&, int&)’ 57 | fill(i,j); | ~~~~^~~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: candidate: ‘template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)’ 1000 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) | ^~~~ /usr/include/c++/13/bits/stl_algobase.h:1000:5: note: template argument deduction/substitution failed: fill.cpp:57:15: note: candidate expects 3 arguments, 2 provided 57 | fill(i,j); | ~~~~^~~~~ fill.cpp:8:6: note: candidate: ‘void fill()’ 8 | void fill() | ^~~~ fill.cpp:8:6: note: candidate expects 0 arguments, 2 provided fill.cpp:58:17: error: ‘maxi’ was not declared in this scope 58 | if(nr>maxi) | ^~~~ fill.cpp:62:7: error: reference to ‘cout’ is ambiguous 62 | cout<<maxi<<" "<<maxp; | ^~~~ /usr/include/c++/13/iostream:63:18: note: candidates are: ‘std::ostream std::cout’ 63 | extern ostream cout; ///< Linked to standard output | ^~~~ fill.cpp:5:10: note: ‘std::ofstream cout’ 5 | ofstream cout("lac_x.out"); | ^~~~ fill.cpp:62:13: error: ‘maxi’ was not declared in this scope 62 | cout<<maxi<<" "<<maxp; | ^~~~ fill.cpp:62:24: error: ‘maxp’ was not declared in this scope 62 | cout<<maxi<<" "<<maxp; | ^~~~
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ă.