#4443
Steve Stonecutter se află într-o lume formată din cuburi, iar fiecare cub aparține unui singur biom. Cuburile sunt dispuse într-o linie și sunt numerotate de la 1 la N. Se consideră că blocurile i și i + 1 sunt vecine între ele pentru toate valorile i de la 1 la N - 1. Putem reprezenta această lume ca și un șir de caractere S de lungime N format din litere mici ale alfabetului limbii engleze, numerotat de la 1 la N, unde al i-lea caracter reprezintă biomul din care face parte al i-lea cub. Aceste mișcări se pot realiza dacă și numai dacă poziția în care Steve vrea să se deplaseze există. Începând de la cubul 1, Steve dorește să ajungă la cubul N cu cost minim, așa că vă roagă pe voi să aflați care este acest cost.
| Problema | biom | Operații I/O |
biom.in/biom.out
|
|---|---|---|---|
| Limita timp | 0.6 secunde | Limita memorie |
Total: 256 MB
/
Stivă 64 MB
|
| Id soluție | #57556684 | Utilizator | |
| Fișier | biom.cpp | Dimensiune | 3.63 KB |
| Data încărcării | 04 Aprilie 2025, 14:05 | Scor/rezultat | Eroare de compilare |
biom.cpp:13:35: warning: missing terminating ' character [enabled by default] #define INFINITY 1'000'000'000'000'000 ^ biom.cpp:28:12: warning: multi-character character constant [-Wmultichar] int data[MAX_N]; ^ biom.cpp:32:8: warning: multi-character character constant [-Wmultichar] node v[MAX_N]; ^ biom.cpp:117:17: warning: multi-character character constant [-Wmultichar] v[i].cost = INFINITY; ^ biom.cpp:117:17: warning: multi-character character constant [-Wmultichar] biom.cpp:117:5: error: missing terminating ' character v[i].cost = INFINITY; ^ biom.cpp:11:16: error: expected ']' before '\x303030' #define MAX_N 1'000'000 ^ biom.cpp:28:12: note: in expansion of macro 'MAX_N' int data[MAX_N]; ^ biom.cpp:11:16: error: expected ']' before '\x303030' #define MAX_N 1'000'000 ^ biom.cpp:32:8: note: in expansion of macro 'MAX_N' node v[MAX_N]; ^ biom.cpp: In function 'void read_input_data()': biom.cpp:43:5: error: 'v' was not declared in this scope v[i].left = v[i].right = NONE; ^ biom.cpp:51:7: error: 'v' was not declared in this scope v[i].left = prev[type]; ^ biom.cpp: In function 'void queue_push(int, int)': biom.cpp:72:8: error: 'struct queue' has no member named 'data' q[k].data[q[k].tail++] = pos; ^ biom.cpp: In function 'int queue_pop(int)': biom.cpp:76:15: error: 'struct queue' has no member named 'data' return q[k].data[q[k].head++]; ^ biom.cpp: In function 'int queue_peek(int)': biom.cpp:80:15: error: 'struct queue' has no member named 'data' return q[k].data[q[k].head]; ^ biom.cpp: In function 'bool queue_is_better(int, int)': biom.cpp:87:6: error: 'v' was not declared in this scope (v[queue_peek(k)].cost < v[queue_peek(best_so_far)].cost); ^ biom.cpp: In function 'void maybe_enqueue(int, int, long long int)': biom.cpp:109:14: error: 'v' was not declared in this scope cost < v[pos].cost) { ^ biom.cpp: In function 'long long int dijkstra()': biom.cpp:117:5: error: 'v' was not declared in this scope v[i].cost = INFINITY; ^ biom.cpp:13:19: error: expected ';' before '\x303030' #define INFINITY 1'000'000'000'000'000 ^ biom.cpp:117:17: note: in expansion of macro 'INFINITY' v[i].cost = INFINITY; ^ biom.cpp:127:37: error: 'v' was not declared in this scope maybe_enqueue(Q_RIGHT, pos + 1, v[pos].cost + cost_right); ^ biom.cpp:133:10: error: 'v' was not declared in this scope return v[n - 1].cost; ^ biom.cpp: In function 'void read_input_data()': biom.cpp:41:44: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] &cost_skip_right, &cost_skip_left); ^ biom.cpp: In function 'int queue_pop(int)': biom.cpp:77:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ biom.cpp: In function 'int queue_peek(int)': biom.cpp:81:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ biom.cpp: In function 'bool queue_is_better(int, int)': biom.cpp:88:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ biom.cpp: In function 'long long int dijkstra()': biom.cpp:134:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema biom 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ă.