#4061
Se dă un graf neorientat cu n vârfuri și un număr natural q. Să se determine toate lanțurile elementare formate din cel puțin o muchie, cu extremitatea finală în vârful q.
| Problema | LantQ | Operații I/O |
lantq.in/lantq.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64373072 | Utilizator | |
| Fișier | lantq.cpp | Dimensiune | 932 B |
| Data încărcării | 04 Mai 2026, 10:07 | Scor/rezultat | Eroare de compilare |
lantq.cpp:7:13: error: variable ‘std::ifstream fin’ has initializer but incomplete type 7 | ifstream fin("lantq.in"); | ^ lantq.cpp:8:14: error: variable ‘std::ofstream fout’ has initializer but incomplete type 8 | ofstream fout("lantq.out"); | ^ lantq.cpp: In function ‘int valid(int)’: lantq.cpp:16:32: error: expected ‘]’ before ‘)’ token 16 | if (k>1 && a[x[k][x[k-1]==1) | ^ | ] lantq.cpp:16:22: error: invalid types ‘int[bool]’ for array subscript 16 | if (k>1 && a[x[k][x[k-1]==1) | ^ lantq.cpp:16:32: error: expected ‘]’ before ‘)’ token 16 | if (k>1 && a[x[k][x[k-1]==1) | ^ | ] lantq.cpp: In function ‘int sol(int)’: lantq.cpp:25:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 25 | if (x[k]=q) | ~~~~^~ lantq.cpp: In function ‘void back(int)’: lantq.cpp:42:13: warning: statement has no effect [-Wunused-value] 42 | x[k]==i; | ~~~~^~~ lantq.cpp:43:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 43 | if (valid(k)==1) | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema LantQ 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ă.