#4607
Se dă o hartă de NxN care conține spații libere (notate cu '.') și spații ocupate (notate cu '#'). Să se răspundă la Q interogări de forma i1 j1 i2 j2, unde se dorește să se afle distanța minimă de la celula (i1, j1) la celula (i2, j2).
| Problema | Astar | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 3.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64045276 | Utilizator | |
| Fișier | astar.cpp | Dimensiune | 3.54 KB |
| Data încărcării | 12 Aprilie 2026, 20:43 | Scor/rezultat | Eroare de compilare |
astar.cpp: In function 'void bfs(int, int, int)': astar.cpp:30:14: error: expected unqualified-id before '[' token auto [x, y] = q.front(); ^ astar.cpp:34:22: error: 'x' was not declared in this scope int nx = x + dx[k]; ^ astar.cpp:35:22: error: 'y' was not declared in this scope int ny = y + dy[k]; ^ astar.cpp: In function 'int main()': astar.cpp:76:14: error: expected unqualified-id before '[' token auto [sx, sy] = free_cells[i]; ^ astar.cpp:82:20: error: 'sx' was not declared in this scope local_dist[sx][sy] = 0; ^ astar.cpp:82:24: error: 'sy' was not declared in this scope local_dist[sx][sy] = 0; ^ astar.cpp:83:24: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)' q.push({sx, sy}); ^ astar.cpp:83:24: note: candidates are: In file included from /usr/include/c++/4.8/queue:64:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:85, from astar.cpp:1: /usr/include/c++/4.8/bits/stl_queue.h:212:7: note: void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:212:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_queue.h:217:7: note: void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:217:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}' astar.cpp:86:18: error: expected unqualified-id before '[' token auto [x, y] = q.front(); ^ astar.cpp:90:26: error: 'x' was not declared in this scope int nx = x + dx[k]; ^ astar.cpp:91:26: error: 'y' was not declared in this scope int ny = y + dy[k]; ^ astar.cpp:103:18: error: expected unqualified-id before '[' token auto [tx, ty] = free_cells[j]; ^ astar.cpp:104:41: error: 'tx' was not declared in this scope all_dist[i][j] = local_dist[tx][ty]; ^ astar.cpp:104:45: error: 'ty' was not declared in this scope all_dist[i][j] = local_dist[tx][ty]; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Astar 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ă.