#2073
PlatouK_v2
Fiind dat un șir de numere, numim secvenţă a acestuia o parte dintre termenii şirului luaţi de pe poziţii consecutive. Denumim platou al acestui şir o secvenţă formată din valori identice. Lungimea unui platou este egală cu numărul de elemente care îl formează.
Asupra unui şir se poate efectua următoarea operaţiune:
Să se scrie un program care citește un șir de n
numere naturale din intervalul [0,5000000]
și un număr k
și determină:
k
orik
operațiuniProblema | PlatouK_v2 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.22 secunde | Limita memorie |
Total: 5.5 MB
/
Stivă 5.5 MB
|
Id soluție | #50735940 | Utilizator | |
Fișier | platouk_v2.cpp | Dimensiune | 1.50 KB |
Data încărcării | 26 Aprilie 2024, 16:46 | Scor / rezultat | Eroare de compilare |
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from platouk_v2.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h: In instantiation of 'struct std::pair<const short int, short int []>': platouk_v2.cpp:27:12: required from here /usr/include/c++/4.8/bits/stl_pair.h:102:11: error: 'std::pair<_T1, _T2>::second' has incomplete type _T2 second; /// @c second is a copy of the second object ^ /usr/include/c++/4.8/bits/stl_pair.h:102:11: error: invalid use of array with unspecified bounds platouk_v2.cpp: In function 'int main()': platouk_v2.cpp:16:21: warning: unused variable 'e' [-Wunused-variable] int k, n, p, l, e, maxx, elem, x, x_vit; ^ In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from platouk_v2.cpp:1: /usr/include/c++/4.8/bits/stl_map.h: In instantiation of 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = short int; _Tp = short int []; _Compare = std::less<short int>; _Alloc = std::allocator<std::pair<const short int, short int []> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = short int []; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = short int]': platouk_v2.cpp:27:12: required from here /usr/include/c++/4.8/bits/stl_map.h:487:16: error: 'struct std::pair<const short int, short int []>' has no member named 'second' return (*__i).second; ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from platouk_v2.cpp:1: /usr/include/c++/4.8/tuple: In instantiation of 'std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {short int&&}; unsigned int ..._Indexes1 = {0u}; _Args2 = {}; unsigned int ..._Indexes2 = {}; _T1 = const short int; _T2 = short int []]': /usr/include/c++/4.8/tuple:1079:63: required from 'std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {short int&&}; _Args2 = {}; _T1 = const short int; _T2 = short int []]' /usr/include/c++/4.8/bits/stl_tree.h:140:49: required from 'std::_Rb_tree_node<_Val>::_Rb_tree_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<short int&&>, std::tuple<>}; _Val = std::pair<const short int, short int []>]' /usr/include/c++/4.8/ext/new_allocator.h:120:4: required from 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::_Rb_tree_node<std::pair<const short int, short int []> >; _Args = {const std::piecewise_construct_t&, std::tuple<short int&&>, std::tuple<>}; _Tp = std::_Rb_tree_node<std::pair<const short int, short int []> >]' /usr/include/c++/4.8/bits/alloc_traits.h:254:4: required from 'static typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Rb_tree_node<std::pair<const short int, short int []> >; _Args = {const std::piecewise_construct_t&, std::tuple<short int&&>, std::tuple<>}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const short int, short int []> > >; typename std::enable_if<std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::value, void>::type = void]' /usr/include/c++/4.8/bits/alloc_traits.h:393:57: required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::_Rb_tree_node<std::pair<const short int, short int []> >; _Args = {const std::piecewise_construct_t&, std::tuple<short int&&>, std::tuple<>}; _Alloc = std::allocator<std::_Rb_tree_node<std::pair<const short int, short int []> > >; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]' /usr/include/c++/4.8/bits/stl_tree.h:408:36: required from 'std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<short int&&>, std::tuple<>}; _Key = short int; _Val = std::pair<const short int, short int []>; _KeyOfValue = std::_Select1st<std::pair<const short int, short int []> >; _Compare = std::less<short int>; _Alloc = std::allocator<std::pair<const short int, short int []> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const short int, short int []> >*]' /usr/include/c++/4.8/bits/stl_tree.h:1669:64: required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, _Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<short int&&>, std::tuple<>}; _Key = short int; _Val = std::pair<const short int, short int []>; _KeyOfValue = std::_Select1st<std::pair<const short int, short int []> >; _Compare = std::less<short int>; _Alloc = std::allocator<std::pair<const short int, short int []> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const short int, short int []> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const short int, short int []> >]' /usr/include/c++/4.8/bits/stl_map.h:484:8: required from 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = short int; _Tp = short int []; _Compare = std::less<short int>; _Alloc = std::allocator<std::pair<const short int, short int []> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = short int []; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = short int]' platouk_v2.cpp:27:12: required from here /usr/include/c++/4.8/tuple:1090:70: error: using invalid field 'std::pair<_T1, _T2>::second' second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PlatouK_v2 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ă.