#1861
TopSort
Se dă un graf orientat aciclic cu N
noduri numerotate de la 1
la N
. Să se realizeze o sortare topologică a nodurilor.
Problema | TopSort | Operații I/O |
topsort.in /topsort.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #28688008 | Utilizator | |
Fișier | topsort.cpp | Dimensiune | 651 B |
Data încărcării | 15 Martie 2021, 10:10 | Scor / rezultat | Eroare de compilare |
topsort.cpp:2:1: error: 'ifstream' does not name a type ifstream f("topsort.in"); ^ topsort.cpp:3:1: error: 'ofstream' does not name a type ofstream g("toprsort.out") ^ topsort.cpp:5:31: error: size of array 'a' is too large int i,n,m,x,y,a[100001][400001],b[100001][400001],viz[100001],postordine[100001],gri[100001]; ^ topsort.cpp:5:49: error: size of array 'b' is too large int i,n,m,x,y,a[100001][400001],b[100001][400001],viz[100001],postordine[100001],gri[100001]; ^ topsort.cpp: In function 'void dfs(int)': topsort.cpp:10:16: error: 'b' was not declared in this scope for(i=1;i<=b[x][0];++i) ^ topsort.cpp:11:21: error: invalid types 'int[int]' for array subscript if(viz[b[x[i]]) ^ topsort.cpp:11:23: error: expected ']' before ')' token if(viz[b[x[i]]) ^ topsort.cpp:13:7: error: 'nr' was not declared in this scope ++nr; ^ topsort.cpp: In function 'int main()': topsort.cpp:18:4: error: 'f' was not declared in this scope f>>n>>m; ^ topsort.cpp:21:8: error: 'cin' was not declared in this scope cin>>x>>y; ^ topsort.cpp:22:8: error: 'a' was not declared in this scope a[x][y]=1; ^ topsort.cpp:23:8: error: 'b' was not declared in this scope b[x][0]++; ^ topsort.cpp:31:9: error: 'g' was not declared in this scope g<<postordine[i]<<' '; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema TopSort 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ă.