#3862
Vi se dă un număr natural n și o secvență b[1], ..., b[n] ∊ {true, false}. Se garantează că există un număr natural k pentru care n = 2k - 1. Trebuie să generați o permutare p a elementelor {1, 2, ..., n} care îndeplinește anumite condiții. Fie S(p) numărul de indici i ∈ {1, 2, ..., n} pentru care binary_search(n, p, i) nu returnează b[i].
| Problema | binarysearch | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.9 secunde | Limita memorie |
Total: 256 MB
/
Stivă 8 MB
|
| Id soluție | #57186324 | Utilizator | |
| Fișier | binarysearch.cpp | Dimensiune | 3.20 KB |
| Data încărcării | 19 Martie 2025, 15:04 | Scor/rezultat | Eroare de compilare |
binarysearch.cpp:13:16: error: parameter declared 'auto' template <auto N> ^ binarysearch.cpp:15:41: error: 'N' was not declared in this scope constexpr stringlit(const char (&s)[N]) { std::copy(s, s + N, v); } ^ binarysearch.cpp:16:12: error: 'N' was not declared in this scope char v[N]; ^ binarysearch.cpp: In constructor 'constexpr helper::stringlit<<declaration error> >::stringlit(...)': binarysearch.cpp:15:57: error: 's' was not declared in this scope constexpr stringlit(const char (&s)[N]) { std::copy(s, s + N, v); } ^ binarysearch.cpp:15:64: error: 'N' was not declared in this scope constexpr stringlit(const char (&s)[N]) { std::copy(s, s + N, v); } ^ binarysearch.cpp:15:67: error: 'v' was not declared in this scope constexpr stringlit(const char (&s)[N]) { std::copy(s, s + N, v); } ^ binarysearch.cpp:15:71: error: constexpr constructor does not have empty body constexpr stringlit(const char (&s)[N]) { std::copy(s, s + N, v); } ^ binarysearch.cpp: At global scope: binarysearch.cpp:21:19: error: 'helper::stringlit' is not a type template <helper::stringlit I, helper::stringlit O> ^ binarysearch.cpp:21:40: error: 'helper::stringlit' is not a type template <helper::stringlit I, helper::stringlit O> ^ binarysearch.cpp: In constructor 'io::redir_<I, O>::redir_()': binarysearch.cpp:26:25: error: request for member 'v' in 'I', which is of non-class type 'int' in = ifstream(I.v); ^ binarysearch.cpp:28:26: error: request for member 'v' in 'O', which is of non-class type 'int' out = ofstream(O.v); ^ binarysearch.cpp: At global scope: binarysearch.cpp:32:19: error: 'helper::stringlit' is not a type template <helper::stringlit I, helper::stringlit O> ^ binarysearch.cpp:32:40: error: 'helper::stringlit' is not a type template <helper::stringlit I, helper::stringlit O> ^ binarysearch.cpp:34:35: error: '$r' declared as an 'inline' field inline static redir_<I, O> $r{}; ^ binarysearch.cpp: In lambda function: binarysearch.cpp:103:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] const bool place_ones = sleft <= i1.size(); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema binarysearch 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ă.