#639
Inaltime
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 | #36298614 | Utilizator | |
Fișier | inaltime.cpp | Dimensiune | 694 B |
Data încărcării | 14 Aprilie 2022, 12:02 | Scor / rezultat | Eroare de compilare |
inaltime.cpp:3:13: error: variable 'std::ifstream cin' has initializer but incomplete type ifstream cin("inaltime.in"); ^ inaltime.cpp:4:14: error: variable 'std::ofstream cout' has initializer but incomplete type ofstream cout("inaltime.out"); ^ inaltime.cpp:5:1: error: 'vector' does not name a type vector <int> G[101]; ^ inaltime.cpp: In function 'void dfs(int)': inaltime.cpp:10:16: error: 'G' was not declared in this scope for(auto i:G[x]) ^ inaltime.cpp: In function 'int main()': inaltime.cpp:19:5: error: reference to 'cin' is ambiguous cin >> n; ^ inaltime.cpp:3:10: note: candidates are: <typeprefixerror>cin ifstream cin("inaltime.in"); ^ In file included from inaltime.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ inaltime.cpp:22:9: error: reference to 'cin' is ambiguous cin >> T[i]; ^ inaltime.cpp:3:10: note: candidates are: <typeprefixerror>cin ifstream cin("inaltime.in"); ^ In file included from inaltime.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ inaltime.cpp:25:13: error: 'G' was not declared in this scope G[T[i]].push_back(i); ^ inaltime.cpp:33:5: error: reference to 'cout' is ambiguous cout << maxi + 1; ^ inaltime.cpp:4:10: note: candidates are: <typeprefixerror>cout ofstream cout("inaltime.out"); ^ In file included from inaltime.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
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ă.