#3963
maxq
Johnie a început să se joace cu un vector de numere. El dispune iniţial de un vector V
cu N
numere întregi (numerotate de la 0
la N - 1
) şi poate efectua următoarele operaţii:
p
cu un alt număr întreg;V
inclusă între indicii a
şi b
;ONI 2007, clasele 11-12
Problema | maxq | Operații I/O |
maxq.in /maxq.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 32 MB
/
Stivă 1 MB
|
Id soluție | #54788458 | Utilizator | |
Fișier | maxq.cpp | Dimensiune | 3.84 KB |
Data încărcării | 08 Decembrie 2024, 20:21 | Scor / rezultat | Eroare de compilare |
maxq.cpp: In function 'void calculeaza_batog(int)': maxq.cpp:37:45: error: no matching function for call to 'max(long long int, int&)' sum_pref = max(sum_pref + v[i], v[i]); ^ maxq.cpp:37:45: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:37:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_pref = max(sum_pref + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:37:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_pref = max(sum_pref + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:37:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_pref = max(sum_pref + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:37:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_pref = max(sum_pref + v[i], v[i]); ^ maxq.cpp:38:43: error: no matching function for call to 'max(long long int, int&)' sum_suf = max(sum_suf + v[i], v[i]); ^ maxq.cpp:38:43: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:38:43: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_suf = max(sum_suf + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:38:43: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_suf = max(sum_suf + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:38:43: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_suf = max(sum_suf + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:38:43: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_suf = max(sum_suf + v[i], v[i]); ^ maxq.cpp: In function 'long long int query(int, int)': maxq.cpp:73:49: error: no matching function for call to 'max(long long int, int&)' sum_left = max(sum_left + v[i], v[i]); ^ maxq.cpp:73:49: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:73:49: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_left = max(sum_left + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:73:49: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_left = max(sum_left + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:73:49: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_left = max(sum_left + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:73:49: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_left = max(sum_left + v[i], v[i]); ^ maxq.cpp:74:51: error: no matching function for call to 'max(long long int, int&)' sum_right = max(sum_right + v[i], v[i]); ^ maxq.cpp:74:51: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:74:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_right = max(sum_right + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:74:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_right = max(sum_right + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:74:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_right = max(sum_right + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:74:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_right = max(sum_right + v[i], v[i]); ^ maxq.cpp:81:49: error: no matching function for call to 'max(long long int, int&)' sum_left = max(sum_left + v[i], v[i]); ^ maxq.cpp:81:49: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:81:49: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_left = max(sum_left + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:81:49: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_left = max(sum_left + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:81:49: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_left = max(sum_left + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:81:49: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_left = max(sum_left + v[i], v[i]); ^ maxq.cpp:86:51: error: no matching function for call to 'max(long long int, int&)' sum_right = max(sum_right + v[i], v[i]); ^ maxq.cpp:86:51: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:86:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_right = max(sum_right + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:61:0, from maxq.cpp:2: /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: maxq.cpp:86:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum_right = max(sum_right + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:86:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_right = max(sum_right + v[i], v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from maxq.cpp:2: /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: maxq.cpp:86:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum_right = max(sum_right + v[i], v[i]); ^ maxq.cpp: In function 'int main()': maxq.cpp:102:29: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen(FIN, "r", stdin); ^ maxq.cpp:103:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen(FOUT, "w", stdout); ^ maxq.cpp:105:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ maxq.cpp:111:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &v[i]); ^ maxq.cpp:119:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &M); ^ maxq.cpp:122:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d %d", &t, &v1, &v2); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema maxq 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ă.