#3446
Ateleport
Marian se află în galaxia OJI-2020 și este anul 11235. În această galaxie există N
planete diferite și M
canale bidirecţionale de transport de tipul (x, y, t)
care îţi permit să te deplasezi de pe planeta x
pe planeta y
(sau invers) în t
secunde.
Dar Marian este un adevărat inginer și, pentru că i se pare foarte ineficientă această metodă de transport, a dezvoltat un dispozitiv care îți permite teleportarea de pe o planetă x
pe orice altă planetă y
în P
secunde cu condiţia că ai putea ajunge pornind de pe planeta x
pe planeta y
folosind maxim L
canale de transport.
Acest dispozitiv este momentan doar un prototip, așa că nu îl poate folosi mai mult de K
ori. Marian se află pe planeta 1
și te roagă să îi spui care e timpul minim necesar pentru a ajunge pe planeta N
.
Să se scrie un program care calculează timpul minim necesar pentru a ajunge pe planeta N
pornind de pe planeta 1
.
OJI 2020, clasele XI-XII
Problema | Ateleport | Operații I/O |
ateleport.in /ateleport.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 32 MB
/
Stivă 32 MB
|
Id soluție | #53866278 | Utilizator | |
Fișier | ateleport.cpp | Dimensiune | 2.72 KB |
Data încărcării | 13 Noiembrie 2024, 15:45 | Scor / rezultat | Eroare de compilare |
ateleport.cpp: In function 'void short_path()': ateleport.cpp:62:24: error: converting to 'std::priority_queue<std::tuple<int, int, int>, std::vector<std::tuple<int, int, int> >, std::greater<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}]' pq.push({0 , 1 , 0}); ^ ateleport.cpp:66:13: error: expected unqualified-id before '[' token auto[current_dist , node , teleports_used] = pq.top(); ^ ateleport.cpp:68:12: error: 'current_dist' was not declared in this scope if(current_dist > d[node][teleports_used]) continue; ^ ateleport.cpp:68:29: error: 'node' was not declared in this scope if(current_dist > d[node][teleports_used]) continue; ^ ateleport.cpp:68:35: error: 'teleports_used' was not declared in this scope if(current_dist > d[node][teleports_used]) continue; ^ ateleport.cpp:69:25: error: 'node' was not declared in this scope for(auto it: ad[node]) ^ ateleport.cpp:73:28: error: 'current_dist' was not declared in this scope int new_dist = current_dist + cost; ^ ateleport.cpp:74:40: error: 'teleports_used' was not declared in this scope if(new_dist < d[next_node][teleports_used]) ^ ateleport.cpp:77:64: error: no matching function for call to 'std::priority_queue<std::tuple<int, int, int>, std::vector<std::tuple<int, int, int> >, std::greater<std::tuple<int, int, int> > >::push(<brace-enclosed initializer list>)' pq.push({new_dist , next_node , teleports_used}); ^ ateleport.cpp:77:64: note: candidates are: In file included from /usr/include/c++/4.8/queue:64:0, from ateleport.cpp:4: /usr/include/c++/4.8/bits/stl_queue.h:496:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::vector<std::tuple<int, int, int> >; _Compare = std::greater<std::tuple<int, int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<int, int, int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:496: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:504:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::vector<std::tuple<int, int, int> >; _Compare = std::greater<std::tuple<int, int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<int, int, int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:504:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::tuple<int, int, int>, std::vector<std::tuple<int, int, int> >, std::greater<std::tuple<int, int, int> > >::value_type&& {aka std::tuple<int, int, int>&&}' ateleport.cpp:80:12: error: 'teleports_used' was not declared in this scope if(teleports_used < k) ^ ateleport.cpp:82:49: error: 'node' was not declared in this scope for(int teleport_target : reachable[node]) ^ ateleport.cpp:84:37: error: 'current_dist' was not declared in this scope int teleport_dist = current_dist + p; ^ ateleport.cpp:88:83: error: no matching function for call to 'std::priority_queue<std::tuple<int, int, int>, std::vector<std::tuple<int, int, int> >, std::greater<std::tuple<int, int, int> > >::push(<brace-enclosed initializer list>)' pq.push({teleport_dist , teleport_target , teleports_used + 1}); ^ ateleport.cpp:88:83: note: candidates are: In file included from /usr/include/c++/4.8/queue:64:0, from ateleport.cpp:4: /usr/include/c++/4.8/bits/stl_queue.h:496:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::vector<std::tuple<int, int, int> >; _Compare = std::greater<std::tuple<int, int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<int, int, int>] push(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:496: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:504:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::tuple<int, int, int>; _Sequence = std::vector<std::tuple<int, int, int> >; _Compare = std::greater<std::tuple<int, int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<int, int, int>] push(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_queue.h:504:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::tuple<int, int, int>, std::vector<std::tuple<int, int, int> >, std::greater<std::tuple<int, int, int> > >::value_type&& {aka std::tuple<int, int, int>&&}'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Ateleport 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ă.