#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 | #64652236 | Utilizator | |
| Fișier | maxmat.cpp | Dimensiune | 547 B |
| Data încărcării | 20 Mai 2026, 16:26 | Scor/rezultat | Eroare de compilare |
maxmat.cpp: In function ‘int main()’: maxmat.cpp:13:9: error: reference to ‘max’ is ambiguous 13 | max = a[i][j]; | ^~~ In file included from /usr/include/c++/13/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from maxmat.cpp:1: /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidates are: ‘template<class _Tp, class _Compare> _Tp std::max(initializer_list<_Tp>, _Compare)’ 5805 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: ‘template<class _Tp> _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ In file included from /usr/include/c++/13/algorithm:60: /usr/include/c++/13/bits/stl_algobase.h:303:5: note: ‘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:5:31: note: ‘int max’ 5 | int n , m , a[26][26] , ind , max; | ^~~ maxmat.cpp:13:17: error: ‘i’ was not declared in this scope 13 | max = a[i][j]; | ^ maxmat.cpp:15:26: error: reference to ‘max’ is ambiguous 15 | if(a[i][j] > max) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidates are: ‘template<class _Tp, class _Compare> _Tp std::max(initializer_list<_Tp>, _Compare)’ 5805 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: ‘template<class _Tp> _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: ‘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:5:31: note: ‘int max’ 5 | int n , m , a[26][26] , ind , max; | ^~~ maxmat.cpp:17:17: error: reference to ‘max’ is ambiguous 17 | max = a[i][j]; | ^~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidates are: ‘template<class _Tp, class _Compare> _Tp std::max(initializer_list<_Tp>, _Compare)’ 5805 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: ‘template<class _Tp> _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: ‘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:5:31: note: ‘int max’ 5 | int n , m , a[26][26] , ind , max; | ^~~ maxmat.cpp:20:17: error: reference to ‘max’ is ambiguous 20 | fout << max << " " << ind << endl; | ^~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidates are: ‘template<class _Tp, class _Compare> _Tp std::max(initializer_list<_Tp>, _Compare)’ 5805 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: ‘template<class _Tp> _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: ‘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:5:31: note: ‘int max’ 5 | int n , m , a[26][26] , ind , max; | ^~~
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ă.