#4113
dulciuri
Tsubasa-chan adoră dulciurile! De curând a apărut un nou tip de desert. Astfel decide să înfăptuiască o nouă fabrică care să producă acest produs delicios. Fabrica conține un container imens pătratic, plin de aluat, de 10
6
x 10
6
unități. Fiecare punct din container are drept coordonate o pereche de numere reale (x, y)
, unde 0 ≤ x, y ≤ 10
6
, iar fiecare punct are o dulceață. Dându-se toate operațiile întreprinse în producerea desertului, să se găsească dulcețurile totale ce sunt găsite la toate operațiile de degustare.
OJI 2022 clasele XI-XII
Problema | dulciuri | Operații I/O |
dulciuri.in /dulciuri.out
|
---|---|---|---|
Limita timp | 0.9 secunde | Limita memorie |
Total: 512 MB
/
Stivă 64 MB
|
Id soluție | #42749374 | Utilizator | |
Fișier | dulciuri.cpp | Dimensiune | 1.43 KB |
Data încărcării | 16 Martie 2023, 09:51 | Scor / rezultat | Eroare de compilare |
dulciuri.cpp:12:25: error: 'int y1' redeclared as different kind of symbol int q, c, x, y, x1, x2, y1, y2, val; ^ In file included from /usr/include/features.h:374:0, from /usr/include/assert.h:35, from /usr/include/c++/4.8/cassert:43, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:33, from dulciuri.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:241:1: error: previous declaration of 'double y1(double)' __MATHCALL (y1,, (_Mdouble_)); ^ dulciuri.cpp: In function 'int main()': dulciuri.cpp:46:17: error: cannot bind 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' fin >> x1 >> y1 >> x2 >> y2; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from dulciuri.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) ^ dulciuri.cpp:47:22: error: ISO C++ forbids incrementing a pointer of type 'double (*)(double)throw ()' [-fpermissive] x1++, y1++, x2++, y2++; ^ dulciuri.cpp:47:22: error: lvalue required as increment operand dulciuri.cpp:50:52: error: invalid operands of types 'int' and 'double(double)throw ()' to binary 'operator-' int abx = abs(x2 - x1), aby = abs(y2 - y1); ^ dulciuri.cpp:57:43: error: no matching function for call to 'max(double (&)(double)throw (), int&)' sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ dulciuri.cpp:57:43: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from dulciuri.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: dulciuri.cpp:57:43: note: deduced conflicting types for parameter 'const _Tp' ('double(double)throw ()' and 'int') sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from dulciuri.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: dulciuri.cpp:57:43: note: deduced conflicting types for parameter 'const _Tp' ('double(double)throw ()' and 'int') sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from dulciuri.cpp:1: /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: dulciuri.cpp:57:43: note: mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double)throw ()' sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from dulciuri.cpp:1: /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: dulciuri.cpp:57:43: note: mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double)throw ()' sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ dulciuri.cpp:57:70: error: no matching function for call to 'min(double (&)(double)throw (), int&)' sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ dulciuri.cpp:57:70: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from dulciuri.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: dulciuri.cpp:57:70: note: deduced conflicting types for parameter 'const _Tp' ('double(double)throw ()' and 'int') sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from dulciuri.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: dulciuri.cpp:57:70: note: deduced conflicting types for parameter 'const _Tp' ('double(double)throw ()' and 'int') sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from dulciuri.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: dulciuri.cpp:57:70: note: mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double)throw ()' sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from dulciuri.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: dulciuri.cpp:57:70: note: mismatched types 'std::initializer_list<_Tp>' and 'double (*)(double)throw ()' sumy = (query(aibv, max(y1, y2)) - query(aibv, min(y1, y2) - 1)) * (double)(1.0 / aby); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema dulciuri 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ă.