#1861
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 | #63334412 | Utilizator | |
| Fișier | topsort.cpp | Dimensiune | 1.71 KB |
| Data încărcării | 26 Februarie 2026, 16:17 | Scor/rezultat | Eroare de compilare |
topsort.cpp:9:14: warning: missing terminating " character [enabled by default] ifstream cin("#include <fstream> ^ topsort.cpp:9:1: error: missing terminating " character ifstream cin("#include <fstream> ^ topsort.cpp:54:4: warning: missing terminating " character [enabled by default] .in"); ^ topsort.cpp:54:1: error: missing terminating " character .in"); ^ topsort.cpp:15:1: error: expected primary-expression before 'using' using namespace std; ^ topsort.cpp:17:13: error: redefinition of 'std::ifstream cin' ifstream cin("topsort.in"); ^ topsort.cpp:9:10: error: 'std::ifstream cin' previously declared here ifstream cin("#include <fstream> ^ topsort.cpp:54:1: error: expected unqualified-id before '.' token .in"); ^ topsort.cpp:57:21: error: redefinition of 'std::vector<int> L [1000005]' vector<int>L[1000005]; ^ topsort.cpp:20:12: error: 'std::vector<int> L [1000005]' previously declared here vector<int>L[1000005]; ^ topsort.cpp:58:5: error: redefinition of 'int n' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:5: error: 'int n' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:7: error: redefinition of 'int m' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:7: error: 'int m' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:9: error: redefinition of 'int start' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:9: error: 'int start' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:15: error: redefinition of 'int x' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:15: error: 'int x' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:17: error: redefinition of 'int y' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:17: error: 'int y' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:19: error: redefinition of 'int z' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:19: error: 'int z' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:29: error: redefinition of 'int d [100005]' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:21: error: 'int d [100005]' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:41: error: redefinition of 'int viz [100005]' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:31: error: 'int viz [100005]' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:43: error: redefinition of 'int s' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:43: error: 'int s' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:53: error: redefinition of 'int vec [1005]' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:45: error: 'int vec [1005]' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:61: error: redefinition of 'int t [1005]' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:55: error: 'int t [1005]' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:63: error: redefinition of 'int cer' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:63: error: 'int cer' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:67: error: redefinition of 'int cost' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:67: error: 'int cost' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:81: error: redefinition of 'int in [150000]' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:72: error: 'int in [150000]' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:91: error: redefinition of 'int c [150000]' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:83: error: 'int c [150000]' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:58:93: error: redefinition of 'int u' int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:21:93: error: 'int u' previously declared here int n,m,start,x,y,z,d[100005],viz[100005],s,vec[1005],t[1005],cer,cost,in[150000],c[150000],u; ^ topsort.cpp:59:17: error: redefinition of 'int a [1500][1500]' int a[1500][1500]; ^ topsort.cpp:22:5: error: 'int a [1500][1500]' previously declared here int a[1500][1500]; ^ topsort.cpp:60:42: error: redefinition of 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > > pq' priority_queue<pi,vector<pi>,greater<pi>>pq; ^ topsort.cpp:23:42: error: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > > pq' previously declared here priority_queue<pi,vector<pi>,greater<pi>>pq; ^ topsort.cpp: In function 'int main()': topsort.cpp:63:5: error: redefinition of 'int main()' int main() ^ topsort.cpp:26:5: error: 'int main()' previously defined here int main() ^
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ă.