#639
Se dă vectorul de tați al unui arbore cu rădăcină cu n noduri. Determinați înălțimea arborelui.
| Problema | Inaltime | Operații I/O |
inaltime.in/inaltime.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64214959 | Utilizator | |
| Fișier | inaltime.cpp | Dimensiune | 461 B |
| Data încărcării | 23 Aprilie 2026, 11:32 | Scor/rezultat | Eroare de compilare |
inaltime.cpp: In function ‘void reid(int, int)’: inaltime.cpp:8:8: error: reference to ‘max’ is ambiguous 8 | if(max<k) | ^~~ 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 inaltime.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) | ^~~ inaltime.cpp:6:5: note: ‘int max’ 6 | int max = 0; | ^~~ inaltime.cpp:9:5: error: reference to ‘max’ is ambiguous 9 | max=k; | ^~~ /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) | ^~~ inaltime.cpp:6:5: note: ‘int max’ 6 | int max = 0; | ^~~ inaltime.cpp:10:19: error: ‘n’ was not declared in this scope 10 | for(int j=0;j<n;j++) | ^ inaltime.cpp:11:12: error: ‘v’ was not declared in this scope 11 | if(v[j]==i) | ^ inaltime.cpp: In function ‘int main()’: inaltime.cpp:25:8: error: reference to ‘max’ is ambiguous 25 | g<<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) | ^~~ inaltime.cpp:6:5: note: ‘int max’ 6 | int max = 0; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Inaltime 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ă.