#2627
h1
Se dau două șiruri de numere naturale a[1]
, a[2]
, …, a[n]
și b[1]
, b[2]
, …, b[m]
. Să se determine câte numere distincte au în comun cele două șiruri. De exemplu, șirurile a=(2,5,1,4,5,1)
și b=(1,1,1,3,7,5)
au în comun două numere distincte: 1
și 5
.
Folclorul informatic
Problema | h1 | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.4 secunde | Limita memorie |
Total: 128 MB
/
Stivă 8 MB
|
Id soluție | #53006722 | Utilizator | |
Fișier | h1.cpp | Dimensiune | 362 B |
Data încărcării | 15 Octombrie 2024, 12:55 | Scor / rezultat | Eroare de compilare |
h1.cpp: In function 'int main()': h1.cpp:16:9: error: no match for 'operator[]' (operand types are 'std::unordered_map<int, int>' and 'std::pair<const int, int>') {if(mpb[x].second>0)ct++;} ^ h1.cpp:16:9: note: candidates are: In file included from /usr/include/c++/4.8/unordered_map:48:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:115, from h1.cpp:1: /usr/include/c++/4.8/bits/unordered_map.h:595:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = int; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = int] operator[](const key_type& __k) ^ /usr/include/c++/4.8/bits/unordered_map.h:595:7: note: no known conversion for argument 1 from 'std::pair<const int, int>' to 'const key_type& {aka const int&}' /usr/include/c++/4.8/bits/unordered_map.h:599:7: note: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type&&) [with _Key = int; _Tp = int; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = int] operator[](key_type&& __k) ^ /usr/include/c++/4.8/bits/unordered_map.h:599:7: note: no known conversion for argument 1 from 'std::pair<const int, int>' to 'std::unordered_map<int, int>::key_type&& {aka int&&}'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema h1 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ă.