#4027
Se dă un graf orientat aciclic (adică nu există circuite). Lungimea unui drum elementar este dată de numărul de arce. Să se determine lungimea maximă a unui drum elementar în acest graf orientat aciclic.
Folclorul informatic
| Problema | LongestPath | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.4 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
| Id soluție | #63263799 | Utilizator | |
| Fișier | longestpath.cpp | Dimensiune | 1.41 KB |
| Data încărcării | 24 Februarie 2026, 09:23 | Scor/rezultat | 90 puncte |
longestpath.cpp: In function 'void desc_niv()': longestpath.cpp:44:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i=0;i<niv[nrniv].size();i++) ^ longestpath.cpp:49:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(j=0;j<g[x].size();j++) ^ longestpath.cpp: In function 'void afisare()': longestpath.cpp:66:9: warning: unused variable 'i' [-Wunused-variable] int i, j, maxim; ^ longestpath.cpp:66:12: warning: unused variable 'j' [-Wunused-variable] int i, j, maxim; ^ longestpath.cpp:66:15: warning: unused variable 'maxim' [-Wunused-variable] int i, j, maxim; ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.008 secunde | OK. | 5 | 5 | ||
| 2 | 0.008 secunde | OK. | 5 | 5 | ||
| 3 | 0.008 secunde | OK. | 5 | 5 | ||
| 4 | 0.008 secunde | OK. | 5 | 5 | ||
| 5 | 0.012 secunde | OK. | 10 | 10 | ||
| 6 | 0.028 secunde | OK. | 10 | 10 | ||
| 7 | 0.064 secunde | OK. | 10 | 10 | ||
| 8 | 0.104 secunde | OK. | 10 | 10 | ||
| 9 | 0.14 secunde | OK. | 10 | 10 | ||
| 10 | Depășit | Limita de timp depășită | 10 | 0 | ||
| 11 | 0.136 secunde | OK. | 10 | 10 | ||
| 12 | 0.164 secunde | OK. | 10 | 10 | ||
| Punctaj total | 90 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema LongestPath 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ă.