#2217
Map
Domnul Map vă pune la dispoziție un șir a[1]
, a[2]
, …, a[n]
de numere naturale. Pentru fiecare a[i]
(i=1..n
) trebuie să spuneți de câte ori apare acest element în secvența a[1]
, a[2]
, …, a[i]
.
Problema | Map | Operații I/O |
map.in /map.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54140884 | Utilizator | |
Fișier | map.cpp | Dimensiune | 239 B |
Data încărcării | 20 Noiembrie 2024, 17:38 | Scor / rezultat | Eroare de compilare |
map.cpp: In function 'int main()': map.cpp:11:4: error: invalid user-defined conversion from 'int' to 'std::map<std::basic_string<char>, int>::key_type&& {aka std::basic_string<char>&&}' [-fpermissive] m[s]++; ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, 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 map.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:490:7: note: candidate is: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>] <near match> basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); ^ /usr/include/c++/4.8/bits/basic_string.h:490:7: note: no known conversion for argument 1 from 'int' to 'const char*' map.cpp:11:4: error: invalid conversion from 'int' to 'const char*' [-fpermissive] m[s]++; ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, 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 map.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:490:7: error: initializing argument 1 of 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' [-fpermissive] basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); ^ map.cpp:11:4: error: conversion to non-const reference type 'std::map<std::basic_string<char>, int>::key_type&& {aka class std::basic_string<char>&&}' from rvalue of type 'std::basic_string<char>' [-fpermissive] m[s]++; ^ map.cpp:12:10: error: invalid user-defined conversion from 'int' to 'std::map<std::basic_string<char>, int>::key_type&& {aka std::basic_string<char>&&}' [-fpermissive] fout<<m[s]<<" "; ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, 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 map.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:490:7: note: candidate is: std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>] <near match> basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); ^ /usr/include/c++/4.8/bits/basic_string.h:490:7: note: no known conversion for argument 1 from 'int' to 'const char*' map.cpp:12:10: error: invalid conversion from 'int' to 'const char*' [-fpermissive] fout<<m[s]<<" "; ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, 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 map.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:490:7: error: initializing argument 1 of 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' [-fpermissive] basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); ^ map.cpp:12:10: error: conversion to non-const reference type 'std::map<std::basic_string<char>, int>::key_type&& {aka class std::basic_string<char>&&}' from rvalue of type 'std::basic_string<char>' [-fpermissive] fout<<m[s]<<" "; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Map 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ă.