#548
Se dă un graf neorientat cu n vârfuri. Determinați, dacă există, un ciclu hamiltonian.
| Problema | Hamilton | Operații I/O |
hamilton.in/hamilton.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64111207 | Utilizator | |
| Fișier | hamilton.cpp | Dimensiune | 1.12 KB |
| Data încărcării | 17 Aprilie 2026, 14:17 | Scor/rezultat | Eroare de compilare |
hamilton.cpp:6:35: error: conflicting declaration ‘int x [101]’ 6 | int i , j , n , k , y , nrs , x , x[101] , a[101]; | ^ hamilton.cpp:6:31: note: previous declaration as ‘int x’ 6 | int i , j , n , k , y , nrs , x , x[101] , a[101]; | ^ hamilton.cpp: In function ‘int suc(int)’: hamilton.cpp:9:9: error: invalid types ‘int[int]’ for array subscript 9 | if(x[k]<n && k<=n) | ^ hamilton.cpp:11:10: error: invalid types ‘int[int]’ for array subscript 11 | x[k]++; | ^ hamilton.cpp: In function ‘int valid(int)’: hamilton.cpp:20:13: error: invalid types ‘int[int]’ for array subscript 20 | if(x[i]==x[k]) | ^ hamilton.cpp:20:19: error: invalid types ‘int[int]’ for array subscript 20 | if(x[i]==x[k]) | ^ hamilton.cpp:22:11: error: invalid types ‘int[int]’ for array subscript 22 | if(a[x[k-1][x[k]]==0) | ^ hamilton.cpp:22:18: error: invalid types ‘int[int]’ for array subscript 22 | if(a[x[k-1][x[k]]==0) | ^ hamilton.cpp:22:25: error: expected ‘]’ before ‘)’ token 22 | if(a[x[k-1][x[k]]==0) | ^ | ] hamilton.cpp: In function ‘int sol(int)’: hamilton.cpp:28:17: error: invalid types ‘int[int]’ for array subscript 28 | if(n==1 && x[k]==x[i]) | ^ hamilton.cpp:28:23: error: invalid types ‘int[int]’ for array subscript 28 | if(n==1 && x[k]==x[i]) | ^ hamilton.cpp: In function ‘void afis(int)’: hamilton.cpp:39:17: error: invalid types ‘int[int]’ for array subscript 39 | g<<x[i]; | ^ hamilton.cpp: In function ‘void back()’: hamilton.cpp:45:4: error: invalid types ‘int[int]’ for array subscript 45 | x[1]=1; | ^ hamilton.cpp:47:4: error: invalid types ‘int[int]’ for array subscript 47 | x[k]=0; | ^ hamilton.cpp:60:12: error: invalid types ‘int[int]’ for array subscript 60 | x[k]=0; | ^ hamilton.cpp:62:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 62 | int main() | ^~ hamilton.cpp:62:9: note: remove parentheses to default-initialize a variable 62 | int main() | ^~ | -- hamilton.cpp:62:9: note: or replace parentheses with braces to value-initialize a variable hamilton.cpp:63:1: error: a function-definition is not allowed here before ‘{’ token 63 | { | ^ hamilton.cpp:72:2: error: expected ‘}’ at end of input 72 | } | ^ hamilton.cpp:49:3: note: to match this ‘{’ 49 | { | ^ hamilton.cpp:72:2: error: expected ‘}’ at end of input 72 | } | ^ hamilton.cpp:43:1: note: to match this ‘{’ 43 | { | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Hamilton 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ă.