#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 | #15194426 | Utilizator | |
Fișier | arbore.cpp | Dimensiune | 472 B |
Data încărcării | 04 Aprilie 2019, 09:46 | Scor / rezultat | Eroare de compilare |
arbore.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream fout("arbore.out") ^ arbore.cpp: In function 'void dfs(int)': arbore.cpp:9:5: error: 'v' was not declared in this scope v[q]=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[q][i]==1&&!v[i]) ^ arbore.cpp:13:9: error: 'x' was not declared in this scope x[i]=q; ^ arbore.cpp: In function 'int main()': arbore.cpp:19:9: error: 'n' was not declared in this scope fin>>n>>k; ^ arbore.cpp:19:12: error: 'k' was not declared in this scope fin>>n>>k; ^ arbore.cpp:20:8: error: 'i' was not declared in this scope for(i=1;i<n;i++) ^ arbore.cpp:22:13: error: 'j' was not declared in this scope fin>>j>>l; ^ arbore.cpp:22:16: error: 'l' was not declared in this scope fin>>j>>l; ^ arbore.cpp:23:8: error: 'a' was not declared in this scope a[l][j]=a[j][l]=1; ^ arbore.cpp:26:8: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ arbore.cpp:27:5: error: 'fout' was not declared in this scope fout<<x[i]<<" "; ^ arbore.cpp:27:11: error: 'x' was not declared in this scope fout<<x[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ă.