#4667
eras
Stadionul pe care Taylor Swift concertează în cadrul Turului Eras poate fi reprezentat cu ajutorul unei matrice cu N
linii și M
coloane, numerotate începând de la 1
. În fiecare celulă (i, j)
, de pe linia i
și coloana j
(1 ≤ i ≤ N
și 1 ≤ j ≤ M
), se află câte un scaun pe care pot fi așezate brățări ale prieteniei. Înainte de concert, pe fiecare dintre dintre cele N x M
scaune, nu se află nicio brățară. Pe durata concertului, Steven efectuează, în ordine, U
modificări, care pot fi de două tipuri:
(L, a, v)
cu semnificația că pe fiecare dintre cele M
scaune de pe linia a
sunt așezate câte v
brățări noi (1 ≤ a ≤ N
);(C, a, v)
cu semnificația că pe fiecare dintre cele N
scaune de pe coloana a
sunt așezate câte v
brățări noi (1 ≤ a ≤ M
).După ce toate modificările au fost efectuate, Caroline îi pune lui Steven, în ordine, Q
întrebări. Pentru fiecare întrebare, se consideră un număr natural K
și descrierile a K
submatrice. Steven trebuie să determine câte brățări sunt, în total, pe scaunele ce se află în cel puțin una dintre cele K
submatrice considerate. Ajutați-l pe Steven să răspundă corect la toate cele Q
întrebări puse de Caroline!
ONI 2024, clasa a 9-a
Problema | eras | Operații I/O |
![]() eras.in /eras.out
|
---|---|---|---|
Limita timp | 1.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57009679 | Utilizator | |
Fișier | eras.cpp | Dimensiune | 3.72 KB |
Data încărcării | 13 Martie 2025, 00:28 | Scor / rezultat | Eroare de compilare |
eras.cpp:68:29: error: 'long long int j1' redeclared as different kind of symbol long long n,m,c,x,y,q,i1,i2,j1,j2,k,sum,ai1,ai2,aj1,aj2,li1,li2,lj1,lj2,ni1, ni2, nj1, nj2; ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from eras.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:238:1: error: previous declaration of 'double j1(double)' __MATHCALL (j1,, (_Mdouble_)); ^ eras.cpp: In function 'bool overlap()': eras.cpp:93:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(j2<j1) ^ eras.cpp:94:19: error: no matching function for call to 'swap(double (&)(double)throw (), long long int&)' swap(j1,j2); ^ eras.cpp:94:19: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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 eras.cpp:1: /usr/include/c++/4.8/bits/move.h:166:5: note: template<class _Tp> void std::swap(_Tp&, _Tp&) swap(_Tp& __a, _Tp& __b) ^ /usr/include/c++/4.8/bits/move.h:166:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: deduced conflicting types for parameter '_Tp' ('double(double)throw ()' and 'long long int') swap(j1,j2); ^ In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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 eras.cpp:1: /usr/include/c++/4.8/bits/move.h:185:5: note: template<class _Tp, unsigned int _Nm> void std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/include/c++/4.8/bits/move.h:185:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: mismatched types '_Tp [_Nm]' and 'double(double)throw ()' swap(j1,j2); ^ 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 eras.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template<class _T1, class _T2> void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: mismatched types 'std::pair<_T1, _T2>' and 'double(double)throw ()' swap(j1,j2); ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from eras.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template<class _CharT, class _Traits, class _Alloc> void std::swap(std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&) swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'double(double)throw ()' swap(j1,j2); ^ In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h:1452:5: note: template<class _Tp, class _Alloc> void std::swap(std::vector<_Tp, _Alloc>&, std::vector<_Tp, _Alloc>&) swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) ^ /usr/include/c++/4.8/bits/stl_vector.h:1452:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'double(double)throw ()' swap(j1,j2); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/bits/stl_bvector.h:112:3: note: void std::swap(std::_Bit_reference, std::_Bit_reference) swap(_Bit_reference __x, _Bit_reference __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:112:3: note: no known conversion for argument 1 from 'double(double)throw ()' to 'std::_Bit_reference' /usr/include/c++/4.8/bits/stl_bvector.h:120:3: note: void std::swap(std::_Bit_reference, bool&) swap(_Bit_reference __x, bool& __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:120:3: note: no known conversion for argument 1 from 'double(double)throw ()' to 'std::_Bit_reference' /usr/include/c++/4.8/bits/stl_bvector.h:128:3: note: void std::swap(bool&, std::_Bit_reference) swap(bool& __x, _Bit_reference __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:128:3: note: no known conversion for argument 1 from 'double(double)throw ()' to 'bool&' In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/array:262:5: note: template<class _Tp, unsigned int _Nm> void std::swap(std::array<_Tp, _Nm>&, std::array<_Tp, _Nm>&) swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) ^ /usr/include/c++/4.8/array:262:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: mismatched types 'std::array<_Tp, _Nm>' and 'double(double)throw ()' swap(j1,j2); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/tuple:1050:5: note: template<class ... _Elements> void std::swap(std::tuple<_Elements ...>&, std::tuple<_Elements ...>&) swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) ^ /usr/include/c++/4.8/tuple:1050:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: mismatched types 'std::tuple<_Elements ...>' and 'double(double)throw ()' swap(j1,j2); ^ In file included from /usr/include/c++/4.8/bits/stl_algo.h:66:0, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/functional:2573:5: note: template<class _Res, class ... _Args> void std::swap(std::function<_Res(_ArgTypes ...)>&, std::function<_Res(_ArgTypes ...)>&) swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) ^ /usr/include/c++/4.8/functional:2573:5: note: template argument deduction/substitution failed: eras.cpp:94:19: note: mismatched types 'std::function<_Res(_ArgTypes ...)>' and 'double(double)throw ()' swap(j1,j2); ^ eras.cpp:98:22: error: no matching function for call to 'max(long long int&, double (&)(double)throw ())' nj1 = max(lj1, j1); ^ eras.cpp:98:22: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, 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 eras.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: eras.cpp:98:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double(double)throw ()') nj1 = max(lj1, j1); ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, 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 eras.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: eras.cpp:98:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double(double)throw ()') nj1 = max(lj1, j1); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from eras.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template argument deduction/substitution failed: eras.cpp:98:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' nj1 = max(lj1, j1); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from eras.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template argument deduction/substitution failed: eras.cpp:98:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' nj1 = max(lj1, j1); ^ eras.cpp: In function 'int main()': eras.cpp:133:16: error: cannot bind 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' fin>>i1>>j1>>i2>>j2; ^ In file included from /usr/include/c++/4.8/iostream:40:0, from eras.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = double(double)throw ()]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ eras.cpp:136:27: error: no matching function for call to 'swap(long long int&, double (&)(double)throw ())' swap(j2,j1); ^ eras.cpp:136:27: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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 eras.cpp:1: /usr/include/c++/4.8/bits/move.h:166:5: note: template<class _Tp> void std::swap(_Tp&, _Tp&) swap(_Tp& __a, _Tp& __b) ^ /usr/include/c++/4.8/bits/move.h:166:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: deduced conflicting types for parameter '_Tp' ('long long int' and 'double(double)throw ()') swap(j2,j1); ^ In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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 eras.cpp:1: /usr/include/c++/4.8/bits/move.h:185:5: note: template<class _Tp, unsigned int _Nm> void std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/include/c++/4.8/bits/move.h:185:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: mismatched types '_Tp [_Nm]' and 'long long int' swap(j2,j1); ^ 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 eras.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template<class _T1, class _T2> void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: mismatched types 'std::pair<_T1, _T2>' and 'long long int' swap(j2,j1); ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from eras.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template<class _CharT, class _Traits, class _Alloc> void std::swap(std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&) swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'long long int' swap(j2,j1); ^ In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h:1452:5: note: template<class _Tp, class _Alloc> void std::swap(std::vector<_Tp, _Alloc>&, std::vector<_Tp, _Alloc>&) swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) ^ /usr/include/c++/4.8/bits/stl_vector.h:1452:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'long long int' swap(j2,j1); ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/bits/stl_bvector.h:112:3: note: void std::swap(std::_Bit_reference, std::_Bit_reference) swap(_Bit_reference __x, _Bit_reference __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:112:3: note: no known conversion for argument 1 from 'long long int' to 'std::_Bit_reference' /usr/include/c++/4.8/bits/stl_bvector.h:120:3: note: void std::swap(std::_Bit_reference, bool&) swap(_Bit_reference __x, bool& __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:120:3: note: no known conversion for argument 1 from 'long long int' to 'std::_Bit_reference' /usr/include/c++/4.8/bits/stl_bvector.h:128:3: note: void std::swap(bool&, std::_Bit_reference) swap(bool& __x, _Bit_reference __y) noexcept ^ /usr/include/c++/4.8/bits/stl_bvector.h:128:3: note: no known conversion for argument 1 from 'long long int' to 'bool&' In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/array:262:5: note: template<class _Tp, unsigned int _Nm> void std::swap(std::array<_Tp, _Nm>&, std::array<_Tp, _Nm>&) swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) ^ /usr/include/c++/4.8/array:262:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: mismatched types 'std::array<_Tp, _Nm>' and 'long long int' swap(j2,j1); ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/tuple:1050:5: note: template<class ... _Elements> void std::swap(std::tuple<_Elements ...>&, std::tuple<_Elements ...>&) swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) ^ /usr/include/c++/4.8/tuple:1050:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: mismatched types 'std::tuple<_Elements ...>' and 'long long int' swap(j2,j1); ^ In file included from /usr/include/c++/4.8/bits/stl_algo.h:66:0, from /usr/include/c++/4.8/algorithm:62, from eras.cpp:3: /usr/include/c++/4.8/functional:2573:5: note: template<class _Res, class ... _Args> void std::swap(std::function<_Res(_ArgTypes ...)>&, std::function<_Res(_ArgTypes ...)>&) swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) ^ /usr/include/c++/4.8/functional:2573:5: note: template argument deduction/substitution failed: eras.cpp:136:27: note: mismatched types 'std::function<_Res(_ArgTypes ...)>' and 'long long int' swap(j2,j1); ^ eras.cpp:138:37: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] sum += findA(i1,j1,i2,j2); ^ eras.cpp:69:11: error: initializing argument 2 of 'long long int findA(int, int, int, int)' [-fpermissive] long long findA(int i1, int j1, int i2, int j2){ ^ eras.cpp:144:37: error: invalid conversion from 'double (*)(double)throw ()' to 'long long int' [-fpermissive] li1 = i1, li2 = i2, lj1 = j1, lj2 =j2; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema eras 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ă.