#1507
Scrieți un program care, pentru o matrice pătratică dată, determină câte grupuri conţine.
| Problema | grupuri | Operații I/O |
grupuri.in/grupuri.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64238642 | Utilizator | |
| Fișier | grupuri.cpp | Dimensiune | 725 B |
| Data încărcării | 24 Aprilie 2026, 16:21 | Scor/rezultat | Eroare de compilare |
grupuri.cpp: In function ‘void fill(int, int)’: grupuri.cpp:9:10: error: ‘y’ was not declared in this scope 9 | a[x][y]=nrGrup; | ^ grupuri.cpp:16:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 16 | if(a[x-1],y) | ^~ grupuri.cpp:17:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 17 | fill(x-1,y,nrGrup);+ | ^ grupuri.cpp:18:1: error: expected primary-expression before ‘}’ token 18 | } | ^ grupuri.cpp: In function ‘int main()’: grupuri.cpp:28:23: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 28 | if(a[i][j]=1) | ~~~~~~~^~ 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 grupuri.cpp:1: /usr/include/c++/13/bits/stl_algobase.h: In instantiation of ‘typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]’: /usr/include/c++/13/bits/stl_algobase.h:977:21: required from ‘void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = int; _Tp = int]’ /usr/include/c++/13/bits/stl_algobase.h:1007:20: required from ‘void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int]’ grupuri.cpp:31:21: required from here /usr/include/c++/13/bits/stl_algobase.h:931:9: error: invalid type argument of unary ‘*’ (have ‘int’) 931 | *__first = __tmp; | ^~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema grupuri 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ă.