#4692
SCCI
Se dă un șir a
1
, a
2
, …, a
n
de numere întregi. În acest șir, o secvență de cel puțin două elemente a
i
, a
i+1
, …, a
j
este SCCI (secvență cu capetele identice) dacă a
i
= a
j
. Să se determine câte secvențe SCCI sunt în șir.
Problema | SCCI | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
Id soluție | #53013431 | Utilizator | |
Fișier | scci.cpp | Dimensiune | 511 B |
Data încărcării | 15 Octombrie 2024, 16:01 | Scor / rezultat | Eroare de compilare |
scci.cpp: In function 'int main()': scci.cpp:11:9: error: expected initializer before 'n' int n; ^ scci.cpp:12:5: error: 'cin' was not declared in this scope cin >> n; ^ scci.cpp:12:12: error: 'n' was not declared in this scope cin >> n; ^ scci.cpp:14:27: error: wrong number of template arguments (1, should be 5) unordered_map<int, int> frequency; ^ In file included from /usr/include/c++/4.8/unordered_map:48:0, from scci.cpp:4: /usr/include/c++/4.8/bits/unordered_map.h:97:11: error: provided for 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> class std::unordered_map' class unordered_map : __check_copy_constructible<_Alloc> ^ scci.cpp:14:38: error: invalid type in declaration before ';' token unordered_map<int, int> frequency; ^ scci.cpp:15:9: error: expected initializer before 'v' int v[1000000]; ^ scci.cpp:18:14: error: expected ';' before 'i' for (int i = 0; i < n; i++) { ^ scci.cpp:18:14: error: 'i' was not declared in this scope scci.cpp:18:26: error: expected ')' before ';' token for (int i = 0; i < n; i++) { ^ scci.cpp:8:18: warning: unused variable 'lnog' [-Wunused-variable] #define int long lnog ^ scci.cpp:18:10: note: in expansion of macro 'int' for (int i = 0; i < n; i++) { ^ scci.cpp:18:28: error: 'i' was not declared in this scope for (int i = 0; i < n; i++) { ^ scci.cpp:18:31: error: expected ';' before ')' token for (int i = 0; i < n; i++) { ^ scci.cpp:26:29: error: no matching function for call to 'begin(int&)' for (const auto& pair : frequency) { ^ scci.cpp:26:29: note: candidates are: In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/stdexcept:39, from /usr/include/c++/4.8/array:38, from /usr/include/c++/4.8/tuple:39, from /usr/include/c++/4.8/unordered_map:41, from scci.cpp:4: /usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm]) begin(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed: scci.cpp:26:29: note: mismatched types '_Tp [_Nm]' and 'int' for (const auto& pair : frequency) { ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/stdexcept:39, from /usr/include/c++/4.8/array:38, from /usr/include/c++/4.8/tuple:39, from /usr/include/c++/4.8/unordered_map:41, from scci.cpp:4: /usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) begin(const _Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = int]': scci.cpp:26:29: required from here /usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int' /usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&) begin(_Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = int]': scci.cpp:26:29: required from here /usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'int' In file included from /usr/include/c++/4.8/utility:74:0, from /usr/include/c++/4.8/unordered_map:38, from scci.cpp:4: /usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>) begin(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed: scci.cpp:26:29: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for (const auto& pair : frequency) { ^ scci.cpp:26:29: error: no matching function for call to 'end(int&)' scci.cpp:26:29: note: candidates are: In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/stdexcept:39, from /usr/include/c++/4.8/array:38, from /usr/include/c++/4.8/tuple:39, from /usr/include/c++/4.8/unordered_map:41, from scci.cpp:4: /usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm]) end(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed: scci.cpp:26:29: note: mismatched types '_Tp [_Nm]' and 'int' for (const auto& pair : frequency) { ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/stdexcept:39, from /usr/include/c++/4.8/array:38, from /usr/include/c++/4.8/tuple:39, from /usr/include/c++/4.8/unordered_map:41, from scci.cpp:4: /usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&) end(const _Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = int]': scci.cpp:26:29: required from here /usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'const int' /usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&) end(_Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = int]': scci.cpp:26:29: required from here /usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'int' In file included from /usr/include/c++/4.8/utility:74:0, from /usr/include/c++/4.8/unordered_map:38, from scci.cpp:4: /usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>) end(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed: scci.cpp:26:29: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for (const auto& pair : frequency) { ^ scci.cpp:27:13: error: expected initializer before 'k' int k = pair.second; ^ scci.cpp:28:13: error: 'k' was not declared in this scope if (k > 1) { ^ scci.cpp:33:5: error: 'cout' was not declared in this scope cout << pos << endl; ^ scci.cpp:33:20: error: 'endl' was not declared in this scope cout << pos << endl; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SCCI 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ă.