#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 | #41767856 | Utilizator | |
Fișier | arbore.cpp | Dimensiune | 494 B |
Data încărcării | 03 Februarie 2023, 13:32 | Scor / rezultat | Eroare de compilare |
arbore.cpp:3:11: error: variable 'std::ifstream f' has initializer but incomplete type ifstream f("arbore.in") ^ arbore.cpp:4:1: error: expected ',' or ';' before 'ofstream' ofstream g("arbore.out") ^ arbore.cpp: In function 'int main()': arbore.cpp:10:1: error: 'viz' was not declared in this scope viz[k]=1; ^ arbore.cpp:10:5: error: 'k' was not declared in this scope viz[k]=1; ^ arbore.cpp:12:12: error: 'n' was not declared in this scope for(i=1;i<=n;i++) ^ arbore.cpp:16:20: error: 'a' was not declared in this scope if(viz[i]==0 && a[k][i]) ^ arbore.cpp:20:8: error: 'tata' was not declared in this scope tata[i]=k; ^ arbore.cpp:22:13: error: 'dfs' was not declared in this scope dfs(i); ^ arbore.cpp: In function 'int main()': arbore.cpp:30:5: error: redefinition of 'int main()' int main() ^ arbore.cpp:6:5: error: 'int main()' previously defined here int main() ^ arbore.cpp:34:4: error: 'n' was not declared in this scope f>>n>>k; ^ arbore.cpp:34:7: error: 'k' was not declared in this scope f>>n>>k; ^ arbore.cpp:40:7: error: 'x' was not declared in this scope f>>x>>y; ^ arbore.cpp:40:10: error: 'y' was not declared in this scope f>>x>>y; ^ arbore.cpp:42:4: error: 'a' was not declared in this scope a[x][y]=a[y][x]=1; ^ arbore.cpp:46:6: error: 'dfs' was not declared in this scope dfs(k); ^ arbore.cpp:48:1: error: 'viz' was not declared in this scope viz[k]=1; ^ arbore.cpp:52:4: error: 'g' was not declared in this scope g<<tata[i]<<" "; ^ arbore.cpp:52:7: error: 'tata' was not declared in this scope g<<tata[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ă.