#4014
RearanjareSir
Se dă un șir a
0
, a
1
, …, a
n-1
de numere naturale nenule. Trebuie să rearanjați elementele șirului astfel încât pe orice poziție i
(i=0..n-1
) să se afle un număr care are în baza 2 bitul i
setat la 1
.
Folclorul informatic
Problema | RearanjareSir | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
Id soluție | #34599036 | Utilizator | |
Fișier | rearanjaresir.cpp | Dimensiune | 1.11 KB |
Data încărcării | 07 Februarie 2022, 16:07 | Scor / rezultat | Eroare de compilare |
rearanjaresir.cpp: In function 'int main()': rearanjaresir.cpp:51:26: error: no matching function for call to 'std::vector<long long int>::assign(long long int)' mt.assign(max(n,m) -1); ^ rearanjaresir.cpp:51:26: note: candidates are: In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from rearanjaresir.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:479:7: note: void std::vector<_Tp, _Alloc>::assign(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::value_type = long long int] assign(size_type __n, const value_type& __val) ^ /usr/include/c++/4.8/bits/stl_vector.h:479:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_vector.h:498:9: note: template<class _InputIterator, class> void std::vector<_Tp, _Alloc>::assign(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = long long int; _Alloc = std::allocator<long long int>] assign(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.8/bits/stl_vector.h:498:9: note: template argument deduction/substitution failed: rearanjaresir.cpp:51:26: note: candidate expects 2 arguments, 1 provided mt.assign(max(n,m) -1); ^ In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from rearanjaresir.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:524:7: note: void std::vector<_Tp, _Alloc>::assign(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>] assign(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:524:7: note: no known conversion for argument 1 from 'long long int' to 'std::initializer_list<long long int>'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema RearanjareSir 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ă.