#1576
zona3
Se consideră o matrice cu n
linii și m
coloane. Spunem că o poziție este liberă dacă elementul de pe linia i
și coloana j
este egal cu 0
și 1
în caz contrar. Spunem despre mai multe elemente ocupate că formează o zonă, daca elementele se învecinează pe cele patru direcții (sus, jos, dreapta, stânga).
Calculați pentru fiecare zonă numărul de elemente și afișați noua matricea formată prin înlocuirea elementelor egale cu 1
cu numărul de elemente pe care îl are zona din care face parte elementul respectiv.
Problema | zona3 | Operații I/O |
zona3.in /zona3.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #21479802 | Utilizator | |
Fișier | zona3.cpp | Dimensiune | 1.06 KB |
Data încărcării | 02 Martie 2020, 20:04 | Scor / rezultat | Eroare de compilare |
zona3.cpp: In function 'void fill1(int, int, int (*)[102], int&)': zona3.cpp:9:16: error: no matching function for call to 'fill(int, int&, int (*&)[102], int&)' fill(x-1,y,a,d); ^ zona3.cpp:9:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:9:16: note: candidate expects 3 arguments, 4 provided fill(x-1,y,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:9:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x-1,y,a,d); ^ zona3.cpp:10:16: error: no matching function for call to 'fill(int, int&, int (*&)[102], int&)' fill(x+1,y,a,d); ^ zona3.cpp:10:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:10:16: note: candidate expects 3 arguments, 4 provided fill(x+1,y,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:10:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x+1,y,a,d); ^ zona3.cpp:11:16: error: no matching function for call to 'fill(int&, int, int (*&)[102], int&)' fill(x,y+1,a,d); ^ zona3.cpp:11:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:11:16: note: candidate expects 3 arguments, 4 provided fill(x,y+1,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:11:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x,y+1,a,d); ^ zona3.cpp:12:16: error: no matching function for call to 'fill(int&, int, int (*&)[102], int&)' fill(x,y-1,a,d); ^ zona3.cpp:12:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:12:16: note: candidate expects 3 arguments, 4 provided fill(x,y-1,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:12:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x,y-1,a,d); ^ zona3.cpp: In function 'void fill2(int, int, int (*)[102], int)': zona3.cpp:21:16: error: no matching function for call to 'fill(int, int&, int (*&)[102], int&)' fill(x-1,y,a,d); ^ zona3.cpp:21:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:21:16: note: candidate expects 3 arguments, 4 provided fill(x-1,y,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:21:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x-1,y,a,d); ^ zona3.cpp:22:16: error: no matching function for call to 'fill(int, int&, int (*&)[102], int&)' fill(x+1,y,a,d); ^ zona3.cpp:22:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:22:16: note: candidate expects 3 arguments, 4 provided fill(x+1,y,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:22:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x+1,y,a,d); ^ zona3.cpp:23:16: error: no matching function for call to 'fill(int&, int, int (*&)[102], int&)' fill(x,y+1,a,d); ^ zona3.cpp:23:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:23:16: note: candidate expects 3 arguments, 4 provided fill(x,y+1,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:23:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x,y+1,a,d); ^ zona3.cpp:24:16: error: no matching function for call to 'fill(int&, int, int (*&)[102], int&)' fill(x,y-1,a,d); ^ zona3.cpp:24:16: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) ^ /usr/include/c++/4.8/bits/stl_algobase.h:721:5: note: template argument deduction/substitution failed: zona3.cpp:24:16: note: candidate expects 3 arguments, 4 provided fill(x,y-1,a,d); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from zona3.cpp:1: /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: void std::fill(std::_Bit_iterator, std::_Bit_iterator, const bool&) fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) ^ /usr/include/c++/4.8/bits/stl_bvector.h:390:3: note: candidate expects 3 arguments, 4 provided In file included from /usr/include/c++/4.8/deque:66:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:67, from zona3.cpp:1: /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template<class _Tp> void std::fill(const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const std::_Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&) fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, ^ /usr/include/c++/4.8/bits/deque.tcc:921:5: note: template argument deduction/substitution failed: zona3.cpp:24:16: note: mismatched types 'const std::_Deque_iterator<_Tp, _Tp&, _Tp*>' and 'int' fill(x,y-1,a,d); ^ zona3.cpp: In function 'int main()': zona3.cpp:30:27: warning: unused variable 'k' [-Wunused-variable] int n,m,a[102][102],i,k=0,j,max,pmax,nr=0,v[2501],d; ^ zona3.cpp:30:33: warning: unused variable 'max' [-Wunused-variable] int n,m,a[102][102],i,k=0,j,max,pmax,nr=0,v[2501],d; ^ zona3.cpp:30:37: warning: unused variable 'pmax' [-Wunused-variable] int n,m,a[102][102],i,k=0,j,max,pmax,nr=0,v[2501],d; ^ zona3.cpp:30:47: warning: unused variable 'v' [-Wunused-variable] int n,m,a[102][102],i,k=0,j,max,pmax,nr=0,v[2501],d; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema zona3 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ă.