#3724
Dreptunghi2
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.
OJI 2021, clasele XI-XII
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 | |
Fișier | dreptunghi2.cpp | Dimensiune | 3.98 KB |
Data încărcării | 17 Octombrie 2024, 22:05 | Scor / rezultat | Eroare de 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; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Dreptunghi2 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ă.