Detalii evaluare #53112836

Rezumat problemă

Se dă un cod de segmentare și numerotare și se cere să se afle:
1. numărul de subdiviziuni pe care acesta le generează;
2. dimensiunile unui dreptunghi de arie minimă pentru care acest cod este valid;
3. numărul de codificări distincte modulo 1.000.000.007, echivalente cu codul citit (în acest număr va fi inclus și codul inițial);
4. primul cod în ordine lexicografică echivalent cu cel dat.

Detalii

Problema Dreptunghi2 Operații I/O tastatură/ecran
Limita timp 0.5 secunde Limita memorie Total: 256 MB / Stivă 8 MB
Id soluție #53112836 Utilizator Sador Lucian (lucisador)
Fișier dreptunghi2.cpp Dimensiune 3.98 KB
Data încărcării 17 Octombrie 2024, 22:05 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

dreptunghi2.cpp: In function 'std::pair<int, int> minDimensions(const string&)':
dreptunghi2.cpp:37:18: error: expected unqualified-id before '[' token
             auto [curRows, curCols] = stk.top();

                  ^
dreptunghi2.cpp:41:36: error: 'curRows' was not declared in this scope
                 if (k <= 0 || k >= curRows) {

                                    ^
dreptunghi2.cpp:44:30: error: 'curCols' was not declared in this scope
                 stk.push({k, curCols});

                              ^
dreptunghi2.cpp:44:38: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
                 stk.push({k, curCols});

                                      ^
dreptunghi2.cpp:44:38: note: candidates are:
In file included from /usr/include/c++/4.8/stack:61:0,
                 from dreptunghi2.cpp:3:
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
dreptunghi2.cpp:45:27: error: 'curRows' was not declared in this scope
                 stk.push({curRows - k, curCols});

                           ^
dreptunghi2.cpp:45:48: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
                 stk.push({curRows - k, curCols});

                                                ^
dreptunghi2.cpp:45:48: note: candidates are:
In file included from /usr/include/c++/4.8/stack:61:0,
                 from dreptunghi2.cpp:3:
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
dreptunghi2.cpp:48:36: error: 'curCols' was not declared in this scope
                 if (k <= 0 || k >= curCols) {

                                    ^
dreptunghi2.cpp:51:27: error: 'curRows' was not declared in this scope
                 stk.push({curRows, k});

                           ^
dreptunghi2.cpp:51:38: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
                 stk.push({curRows, k});

                                      ^
dreptunghi2.cpp:51:38: note: candidates are:
In file included from /usr/include/c++/4.8/stack:61:0,
                 from dreptunghi2.cpp:3:
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
dreptunghi2.cpp:52:36: error: 'curCols' was not declared in this scope
                 stk.push({curRows, curCols - k});

                                    ^
dreptunghi2.cpp:52:48: error: no matching function for call to 'std::stack<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
                 stk.push({curRows, curCols - k});

                                                ^
dreptunghi2.cpp:52:48: note: candidates are:
In file included from /usr/include/c++/4.8/stack:61:0,
                 from dreptunghi2.cpp:3:
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note: void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:186:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}'
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note: void std::stack<_Tp, _Sequence>::push(std::stack<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::stack<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_stack.h:191:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
dreptunghi2.cpp: In function 'int main()':
dreptunghi2.cpp:105:18: error: expected unqualified-id before '[' token
             auto [N, M] = minDimensions(C);

                  ^
dreptunghi2.cpp:106:21: error: 'N' was not declared in this scope
             cout << N << " " << M << endl;

                     ^
dreptunghi2.cpp:106:33: error: 'M' was not declared in this scope
             cout << N << " " << M << endl;

                                 ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Dreptunghi2 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.