#191
Să se determine, pentru fiecare linie a unei matrice, elementul maxim și indicele coloanei pe care se află.
| Problema | MaxMat | Operații I/O |
maxmat.in/maxmat.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64832507 | Utilizator | |
| Fișier | maxmat.cpp | Dimensiune | 469 B |
| Data încărcării | 04 Iunie 2026, 14:09 | Scor/rezultat | Eroare de compilare |
maxmat.cpp: In function ‘int main()’: maxmat.cpp:14:9: error: reference to ‘max’ is ambiguous 14 | max=-9999; | ^~~ 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 maxmat.cpp:2: /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ maxmat.cpp:6:36: note: ‘int max’ 6 | int n,m,i,j,i1,j1,a[602][602],mini,max,ok,d,k; | ^~~ maxmat.cpp:13:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 13 | for(i=1;i<=n;i++) | ^~~ maxmat.cpp:15:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 15 | for(j=1;j<=m;j++) | ^~~ maxmat.cpp:16:24: error: reference to ‘max’ is ambiguous 16 | if(a[i][j]>max){ | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ maxmat.cpp:6:36: note: ‘int max’ 6 | int n,m,i,j,i1,j1,a[602][602],mini,max,ok,d,k; | ^~~ maxmat.cpp:17:17: error: reference to ‘max’ is ambiguous 17 | max=a[i][j]; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ maxmat.cpp:6:36: note: ‘int max’ 6 | int n,m,i,j,i1,j1,a[602][602],mini,max,ok,d,k; | ^~~ maxmat.cpp:20:15: error: reference to ‘max’ is ambiguous 20 | fout<<max<<" "<<d; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ maxmat.cpp:6:36: note: ‘int max’ 6 | int n,m,i,j,i1,j1,a[602][602],mini,max,ok,d,k; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MaxMat 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ă.