#636
Arbore
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 | #43597583 | Utilizator | |
Fișier | arbore.cpp | Dimensiune | 430 B |
Data încărcării | 05 Mai 2023, 09:43 | Scor / rezultat | Eroare de compilare |
arbore.cpp:4:13: error: variable 'std::ifstream fin' has initializer but incomplete type ifstream fin("arbore.in") ^ arbore.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream fout("arbore.out") ^ arbore.cpp: In function 'void df(int)': arbore.cpp:9:5: error: 'viz' was not declared in this scope viz[k]=1; ^ arbore.cpp:10:20: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ arbore.cpp:11:12: error: 'a' was not declared in this scope if(a[k][i]==1 && viz[1]==0) ^ arbore.cpp:13:9: error: 'v' was not declared in this scope v[i]=k; ^ arbore.cpp: In function 'int main()': arbore.cpp:17:8: error: 'n' was not declared in this scope { fin>>n>>k; ^ arbore.cpp:17:11: error: 'k' was not declared in this scope { fin>>n>>k; ^ arbore.cpp:18:14: error: 'i' was not declared in this scope while(fin>>i>>j) ^ arbore.cpp:18:17: error: 'j' was not declared in this scope while(fin>>i>>j) ^ arbore.cpp:19:9: error: 'a' was not declared in this scope a[i][j]=a[j][i]=1; ^ arbore.cpp:21:7: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ arbore.cpp:22:9: error: 'fout' was not declared in this scope fout<<v[i]<<" "; ^ arbore.cpp:22:15: error: 'v' was not declared in this scope fout<<v[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ă.