#3446
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 | #49430933 | Utilizator | |
Fișier | ateleport.cpp | Dimensiune | 1.45 KB |
Data încărcării | 01 Martie 2024, 10:17 | Scor / rezultat | Eroare de compilare |
ateleport.cpp: In function 'void dijkstra(int, int)': ateleport.cpp:15:17: error: invalid types 'int[int]' for array subscript d[ind][i] = 1e9; ^ ateleport.cpp:17:15: error: invalid types 'int[int]' for array subscript d[ind][nod] = 0; ^ ateleport.cpp:30:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < g[node].size(); i++) ^ ateleport.cpp:32:28: error: invalid types 'int[int]' for array subscript if (d[ind][node] + g[node][i].second < d[ind][g[node][i].first]) ^ ateleport.cpp:32:75: error: invalid types 'int[int]' for array subscript if (d[ind][node] + g[node][i].second < d[ind][g[node][i].first]) ^ ateleport.cpp:34:50: error: invalid types 'int[int]' for array subscript s.erase({ d[ind][g[node][i].first], g[node][i].first }); ^ ateleport.cpp:34:71: error: no matching function for call to 'std::set<std::pair<int, int> >::erase(<brace-enclosed initializer list>)' s.erase({ d[ind][g[node][i].first], g[node][i].first }); ^ ateleport.cpp:34:71: note: candidates are: In file included from /usr/include/c++/4.8/set:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from ateleport.cpp:1: /usr/include/c++/4.8/bits/stl_set.h:551:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >] erase(const_iterator __position) ^ /usr/include/c++/4.8/bits/stl_set.h:551:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::set<std::pair<int, int> >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' /usr/include/c++/4.8/bits/stl_set.h:581:7: note: std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::erase(const key_type&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::size_type = unsigned int; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<int, int>] erase(const key_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:581:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const std::pair<int, int>&}' /usr/include/c++/4.8/bits/stl_set.h:603:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::erase(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::const_iterator) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >] erase(const_iterator __first, const_iterator __last) ^ /usr/include/c++/4.8/bits/stl_set.h:603:7: note: candidate expects 2 arguments, 1 provided ateleport.cpp:35:39: error: invalid types 'int[int]' for array subscript s.insert({ d[ind][node] + g[node][i].second, g[node][i].first }); ^ ateleport.cpp:35:80: error: no matching function for call to 'std::set<std::pair<int, int> >::insert(<brace-enclosed initializer list>)' s.insert({ d[ind][node] + g[node][i].second, g[node][i].first }); ^ ateleport.cpp:35:80: note: candidates are: In file included from /usr/include/c++/4.8/set:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from ateleport.cpp:1: /usr/include/c++/4.8/bits/stl_set.h:460:7: note: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<int, int>] insert(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:460: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_set.h:469:7: note: std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<int, int>] insert(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:469:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::set<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}' /usr/include/c++/4.8/bits/stl_set.h:497:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<int, int>] insert(const_iterator __position, const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:497:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_set.h:502:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::const_iterator, std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >; std::set<_Key, _Compare, _Alloc>::value_type = std::pair<int, int>] insert(const_iterator __position, value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_set.h:502:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_set.h:517:2: note: template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >] insert(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.8/bits/stl_set.h:517:2: note: template argument deduction/substitution failed: ateleport.cpp:35:80: note: candidate expects 2 arguments, 1 provided s.insert({ d[ind][node] + g[node][i].second, g[node][i].first }); ^ In file included from /usr/include/c++/4.8/set:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from ateleport.cpp:1: /usr/include/c++/4.8/bits/stl_set.h:529:7: note: void std::set<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >] insert(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_set.h:529:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<std::pair<int, int> >' ateleport.cpp:36:40: error: invalid types 'int[int]' for array subscript d[ind][g[node][i].first] = d[ind][node] + g[node][i].second; ^ ateleport.cpp:36:55: error: invalid types 'int[int]' for array subscript d[ind][g[node][i].first] = d[ind][node] + g[node][i].second; ^ ateleport.cpp:27:13: warning: unused variable 'val' [-Wunused-variable] int val = s.begin()->first; ^ ateleport.cpp: In function 'int main()': ateleport.cpp:57:18: error: too few arguments to function 'void dijkstra(int, int)' dijkstra(); ^ ateleport.cpp:12:6: note: declared here void dijkstra(int ind, int nod) ^
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ă.