#636
Se dau cele n-1 muchii ale unui arbore cu n noduri și un nod k . Afișați vectorul de tați al arborelui cu rădăcina în k.
| Problema | Arbore | Operații I/O |
arbore.in/arbore.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63769033 | Utilizator | |
| Fișier | arbore.cpp | Dimensiune | 545 B |
| Data încărcării | 18 Martie 2026, 11:31 | Scor/rezultat | Eroare de compilare |
arbore.cpp:5:13: error: variable 'std::ifstream fin' has initializer but incomplete type ifstream fin("arbore.in"); ^ arbore.cpp:6:14: error: variable 'std::ofstream fout' has initializer but incomplete type ofstream fout("arbore.out") ^ arbore.cpp:8:1: error: expected ',' or ';' before 'int' int n , k, a[101][101], v[105],t[105]; ^ arbore.cpp: In function 'void dfs(int, int)': arbore.cpp:12:5: error: 'v' was not declared in this scope v[k] = 1; ^ arbore.cpp:13:5: error: 't' was not declared in this scope t[k] = tata; ^ arbore.cpp:14:25: error: 'n' was not declared in this scope for(int i = 1; i <= n; ++i) ^ arbore.cpp:16:25: error: 'a' was not declared in this scope if(v[i] == 0 && a[k][i] == 1) ^ arbore.cpp: In function 'int main()': arbore.cpp:23:12: error: 'n' was not declared in this scope fin >> n >> k; ^ arbore.cpp:23:17: error: 'k' was not declared in this scope fin >> n >> k; ^ arbore.cpp:27:9: error: 'a' was not declared in this scope a[x][y] = a[y][x] = 1; ^ arbore.cpp:31:17: error: 't' was not declared in this scope fout << t[i] << " "; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Arbore 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ă.