#417
Se dă lista muchiilor unui graf neorientat. Să se afișeze vârfurile de grad maxim.
| Problema | GradMax | Operații I/O |
gradmax.in/gradmax.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64558779 | Utilizator | |
| Fișier | gradmax.cpp | Dimensiune | 583 B |
| Data încărcării | 14 Mai 2026, 11:26 | Scor/rezultat | Eroare de compilare |
gradmax.cpp:3:11: error: variable ‘std::ifstream f’ has initializer but incomplete type 3 | ifstream f("grandmax.in"); | ^ gradmax.cpp:4:11: error: variable ‘std::ofstream g’ has initializer but incomplete type 4 | ofstream g("grandmax.out"); | ^ gradmax.cpp: In function ‘int main()’: gradmax.cpp:21:17: error: reference to ‘max’ is ambiguous 21 | if(d[i]>max) {max=d[i]; nr=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/ostream:40, from /usr/include/c++/13/iostream:41, from gradmax.cpp:1: /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) | ^~~ gradmax.cpp:5:30: note: ‘int max’ 5 | int a[101][101],n,i,j,d[101],max,nr; | ^~~ gradmax.cpp:21:23: error: reference to ‘max’ is ambiguous 21 | if(d[i]>max) {max=d[i]; nr=1;} | ^~~ /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) | ^~~ gradmax.cpp:5:30: note: ‘int max’ 5 | int a[101][101],n,i,j,d[101],max,nr; | ^~~ gradmax.cpp:22:24: error: reference to ‘max’ is ambiguous 22 | else if (d[i]==max) nr++; | ^~~ /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) | ^~~ gradmax.cpp:5:30: note: ‘int max’ 5 | int a[101][101],n,i,j,d[101],max,nr; | ^~~ gradmax.cpp:26:18: error: reference to ‘max’ is ambiguous 26 | if(d[i]==max) g<<i<<" "; | ^~~ /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) | ^~~ gradmax.cpp:5:30: note: ‘int max’ 5 | int a[101][101],n,i,j,d[101],max,nr; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GradMax 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ă.