#4098
pulsar
Data stelară 3210: Căpitanul navei USS Entrerprise, Jean-Luc Picard se află într-o misiune importantă în cuadrantul Beta al galaxiei. Acesta trebuie să ajungă cât mai rapid de la planeta Vulcan până la planeta Qo’noS, dar din păcate pentru această misiune Jean-Luc Picard nu va putea să ajungă instantaneu la destinație folosind warp drive-ul navei, ci va trebui să se deplaseze în mod normal, din sector în sector. Vouă vă revine rolul de a îl ajuta pe Jean-Luc Picard și să îi răspundeți la una din următoarele întrebări știind harta galaxiei:
- Care este numărul maxim de sectoare ale galaxiei Smax
afectate la orice moment de timp de către cel puțin un pulsar.
- Care este timpul minim Tmin
de care are nevoie Jean-Luc Picard pentru a ajunge pe planeta Qo’noS.
OJI 2022 clasa a X-a
Problema | pulsar | Operații I/O |
pulsar.in /pulsar.out
|
---|---|---|---|
Limita timp | 2 secunde | Limita memorie |
Total: 256 MB
/
Stivă 64 MB
|
Id soluție | #46052346 | Utilizator | |
Fișier | pulsar.cpp | Dimensiune | 3.30 KB |
Data încărcării | 31 Octombrie 2023, 16:02 | Scor / rezultat | Eroare de compilare |
pulsar.cpp: In lambda function: pulsar.cpp:38:33: error: converting to 'std::queue<std::tuple<int, int, int> >::value_type {aka std::tuple<int, int, int>}' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {int&, int&, int}; <template-parameter-2-2> = void; _Elements = {int, int, int}]' q.push({x, y, cnt * r - t}); ^ pulsar.cpp:43:14: error: expected unqualified-id before '[' token auto [currx, curry, currtime] = q.front(); ^ pulsar.cpp:46:14: error: 'currtime' was not declared in this scope if ((currtime + 1) % r == (r - t) % r) ^ pulsar.cpp:50:22: error: 'currx' was not declared in this scope int newx = currx + dx[dir]; ^ pulsar.cpp:51:22: error: 'curry' was not declared in this scope int newy = curry + dy[dir]; ^ pulsar.cpp:54:16: error: 'currtime' was not declared in this scope (currtime + 1 >= 0 && dp[newx][newy][currtime + 1] == -color)) ^ pulsar.cpp:57:15: error: 'currtime' was not declared in this scope if (currtime + 1 >= 0) ^ pulsar.cpp:59:31: error: 'currtime' was not declared in this scope q.push({newx, newy, currtime + 1}); ^ pulsar.cpp:59:44: error: no matching function for call to 'std::queue<std::tuple<int, int, int> >::push(<brace-enclosed initializer list>)' q.push({newx, newy, currtime + 1}); ^ pulsar.cpp:59:44: 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 pulsar.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::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::tuple<int, 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::tuple<int, 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::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::tuple<int, 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::tuple<int, int, int> >::value_type&& {aka std::tuple<int, int, int>&&}' pulsar.cpp: In lambda function: pulsar.cpp:96:31: error: converting to 'std::queue<std::tuple<int, int, int> >::value_type {aka std::tuple<int, int, int>}' from initializer list would use explicit constructor 'constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {int&, int&, int}; <template-parameter-2-2> = void; _Elements = {int, int, int}]' q.push({xstart, ystart, 0}); ^ pulsar.cpp:100:12: error: expected unqualified-id before '[' token auto [currx, curry, currt] = q.front(); ^ pulsar.cpp:104:20: error: 'currx' was not declared in this scope int newx = currx + dx[dir]; ^ pulsar.cpp:105:20: error: 'curry' was not declared in this scope int newy = curry + dy[dir]; ^ pulsar.cpp:110:33: error: 'currt' was not declared in this scope if (dp[newx][newy][(1 + currt) % lcm]) ^ pulsar.cpp:113:36: error: 'currt' was not declared in this scope if (visited[newx][newy] == currt + 1) ^ pulsar.cpp:117:18: error: 'currt' was not declared in this scope return currt + 1; ^ pulsar.cpp:119:31: error: 'currt' was not declared in this scope visited[newx][newy] = currt + 1; ^ pulsar.cpp:120:41: error: no matching function for call to 'std::queue<std::tuple<int, int, int> >::push(<brace-enclosed initializer list>)' q.push({newx, newy, (1 + currt)}); ^ pulsar.cpp:120:41: 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 pulsar.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::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::tuple<int, 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::tuple<int, 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::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::tuple<int, 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::tuple<int, int, int> >::value_type&& {aka std::tuple<int, int, int>&&}' pulsar.cpp: In function 'int main()': pulsar.cpp:130:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("pulsar.in", "r", stdin); ^ pulsar.cpp:131:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("pulsar.out", "w", stdout); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema pulsar 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ă.