#4785
Se consideră şirul crescător 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, ...
, în care fiecare număr natural nenul i
apare de 2
i-1
ori. Elementele unei matrice A
cu M
linii şi N
coloane au valori astfel încât, parcurgând matricea de sus în jos, pe linii, și de la stânga la dreapta pe fiecare linie, se obțin primii M x N
termeni ai șirului precizat. O submatrice a lui A
este definită de patru valori, l1, c1, l2, c2
şi este formată din elementele A
i,j
cu proprietatea că l1 ≤ i ≤ l2
și c1 ≤ j ≤ c2
. Determinaţi suma elementelor pentru fiecare dintre Q
submatrice date ale lui A
.
OJI 2025, clasa a 9-a
Problema | summat | Operații I/O |
![]() summat.in /summat.out
|
---|---|---|---|
Limita timp | 0.9 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57242912 | Utilizator | |
Fișier | summat.cpp | Dimensiune | 1.81 KB |
Data încărcării | 21 Martie 2025, 12:43 | Scor / rezultat | Eroare de compilare |
summat.cpp: In function 'int main()': summat.cpp:43:52: error: 'make_tuple' was not declared in this scope queries.push_back(make_tuple(l1, c1, l2, c2)); ^ summat.cpp:47:22: error: expected unqualified-id before '[' token for (const auto& [l1, c1, l2, c2] : queries) { ^ summat.cpp:47:22: error: expected ';' before '[' token summat.cpp:47:23: error: 'l1' was not declared in this scope for (const auto& [l1, c1, l2, c2] : queries) { ^ summat.cpp:47:27: error: 'c1' was not declared in this scope for (const auto& [l1, c1, l2, c2] : queries) { ^ summat.cpp:47:31: error: 'l2' was not declared in this scope for (const auto& [l1, c1, l2, c2] : queries) { ^ summat.cpp:47:35: error: 'c2' was not declared in this scope for (const auto& [l1, c1, l2, c2] : queries) { ^ summat.cpp: In lambda function: summat.cpp:47:39: error: expected '{' before ':' token for (const auto& [l1, c1, l2, c2] : queries) { ^ summat.cpp: In function 'int main()': summat.cpp:47:39: error: expected ';' before ':' token summat.cpp:47:39: error: expected primary-expression before ':' token summat.cpp:47:39: error: expected ')' before ':' token summat.cpp:47:39: error: expected primary-expression before ':' token summat.cpp:47:39: error: expected ';' before ':' token In file included from /usr/include/c++/4.8/vector:64:0, from summat.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<long long int, long long int, long long int, long long int>; _Alloc = std::allocator<std::tuple<long long int, long long int, long long int, long long int> >]': /usr/include/c++/4.8/bits/stl_vector.h:249:15: required from 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::tuple<long long int, long long int, long long int, long long int>; _Alloc = std::allocator<std::tuple<long long int, long long int, long long int, long long int> >]' summat.cpp:38:63: required from here /usr/include/c++/4.8/bits/stl_vector.h:161:9: error: invalid use of incomplete type 'class std::tuple<long long int, long long int, long long int, long long int>' - this->_M_impl._M_start); } ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from summat.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of 'class std::tuple<long long int, long long int, long long int, long long int>' class tuple; ^ In file included from /usr/include/c++/4.8/vector:62:0, from summat.cpp:3: /usr/include/c++/4.8/bits/stl_construct.h: In instantiation of 'void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::tuple<long long int, long long int, long long int, long long int>*]': /usr/include/c++/4.8/bits/stl_construct.h:151:31: required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, std::allocator<_T2>&) [with _ForwardIterator = std::tuple<long long int, long long int, long long int, long long int>*; _Tp = std::tuple<long long int, long long int, long long int, long long int>]' /usr/include/c++/4.8/bits/stl_vector.h:416:30: required from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::tuple<long long int, long long int, long long int, long long int>; _Alloc = std::allocator<std::tuple<long long int, long long int, long long int, long long int> >]' summat.cpp:38:63: required from here /usr/include/c++/4.8/bits/stl_construct.h:127:27: error: invalid use of incomplete type '_Value_type {aka class std::tuple<long long int, long long int, long long int, long long int>}' __destroy(__first, __last); ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from summat.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:83:11: error: declaration of '_Value_type {aka class std::tuple<long long int, long long int, long long int, long long int>}' class tuple; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema summat 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ă.