#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 | #28687987 | Utilizator | |
Fișier | topsort.cpp | Dimensiune | 651 B |
Data încărcării | 15 Martie 2021, 10:09 | Scor / rezultat | Eroare de compilare |
topsort.cpp:5:1: error: expected ',' or ';' before 'int' 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:9:5: error: 'viz' was not declared in this scope viz[i]=1; ^ 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:14:5: error: 'postordine' was not declared in this scope postordine[nr]=x; ^ topsort.cpp: In function 'int main()': topsort.cpp:18:7: error: 'n' was not declared in this scope f>>n>>m; ^ topsort.cpp:18:10: error: 'm' was not declared in this scope f>>n>>m; ^ topsort.cpp:19:8: error: 'i' was not declared in this scope for(i=1;i<=n;++i) ^ topsort.cpp:21:8: error: 'cin' was not declared in this scope cin>>x>>y; ^ topsort.cpp:21:13: error: 'x' was not declared in this scope cin>>x>>y; ^ topsort.cpp:21:16: error: 'y' 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:25:8: error: 'gri' was not declared in this scope gri[y]++; ^ topsort.cpp:27:9: error: 'i' was not declared in this scope for(i=1;i<=n;++i) ^ topsort.cpp:28:12: error: 'gri' was not declared in this scope if(gri[i]==0) ^ topsort.cpp:30:9: error: 'i' was not declared in this scope for(i=n;i>1;--i) ^ topsort.cpp:31:12: error: 'postordine' 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ă.