#478
Se dă lista muchiilor unui graf neorientat cu n
vârfuri și un vârf p
. Să se determine un ciclu elementar care conține vârful p
.
Problema | Ciclu | Operații I/O |
![]() ciclu.in /ciclu.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58124273 | Utilizator | |
Fișier | ciclu.cpp | Dimensiune | 850 B |
Data încărcării | 15 Mai 2025, 10:46 | Scor / rezultat | Eroare de compilare |
ciclu.cpp:6:9: error: expected initializer before 'a' int n,m a[21][21],p,x[21],fr[21],ok; ^ ciclu.cpp: In function 'void afis(int)': ciclu.cpp:10:29: error: 'x' was not declared in this scope for(int i=1;i<=k;i++)g<<x[i]<<" "; ^ ciclu.cpp:11:8: error: 'p' was not declared in this scope g<<p; ^ ciclu.cpp: In function 'int valid(int)': ciclu.cpp:16:16: error: 'a' was not declared in this scope if(k>=2)if(a[x[k]][x[k-1]]==0)return 0; ^ ciclu.cpp:16:18: error: 'x' was not declared in this scope if(k>=2)if(a[x[k]][x[k-1]]==0)return 0; ^ ciclu.cpp: In function 'void bkt(int)': ciclu.cpp:21:23: error: 'ok' was not declared in this scope {for(int i=1;i<=n && ok==0;i++) ^ ciclu.cpp:22:9: error: 'fr' was not declared in this scope if(fr[i]==0 ^ ciclu.cpp:23:9: error: expected ')' before '{' token {x[k]=i; ^ ciclu.cpp:30:9: error: expected primary-expression before '}' token } ^ ciclu.cpp:30:9: error: expected ';' before '}' token ciclu.cpp: In function 'int main()': ciclu.cpp:33:16: error: 'm' was not declared in this scope f>>n>>m; ^ ciclu.cpp:34:33: error: 'a' was not declared in this scope while(m!=0){f>>v1>>v2; a[v1][v2]=a[v2][v1]=1; m--;} ^ ciclu.cpp:35:13: error: 'p' was not declared in this scope f>>p; ^ ciclu.cpp:36:10: error: 'x' was not declared in this scope x[1]=p; ^ ciclu.cpp:37:10: error: 'fr' was not declared in this scope fr[p]=1; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Ciclu 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ă.