#4606
trafalet
David este mare zugrav și nu se duce nicăieri fără trafaletul său magic. El are la dispoziție o matrice A
cu N
linii și M
coloane, care este colorată în alb și negru, asemenea unei table de șah. Fiecare celulă a matricei conține o valoare asociată. David vopsește o submatrice cu alb sau negru la alegere. Trafaletul adună automat (pentru că este magic) valorile din celulele vopsite care nu își schimbă culoarea, și scade valorile din celulele vopsite care își schimbă culoarea. Rezultatul acestui calcul este punctajul lui David. Cum David nu a reușit până acum să combine zugrăvitul și programarea, vă roagă pe voi să îl ajutați să obțină punctajul maxim!
OJI 2024, clasa a 9-a
Problema | trafalet | Operații I/O |
trafalet.in /trafalet.out
|
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 256 MB
/
Stivă 8 MB
|
Id soluție | #52167583 | Utilizator | |
Fișier | trafalet.cpp | Dimensiune | 1.54 KB |
Data încărcării | 21 Septembrie 2024, 18:35 | Scor / rezultat | Eroare de compilare |
trafalet.cpp: In function 'int main()': trafalet.cpp:43:32: error: no matching function for call to 'max(long long int&, int)' sum1=max(sum1,0); ^ trafalet.cpp:43:32: 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 trafalet.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: trafalet.cpp:43:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum1=max(sum1,0); ^ 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 trafalet.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: trafalet.cpp:43:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum1=max(sum1,0); ^ 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 trafalet.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: trafalet.cpp:43:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum1=max(sum1,0); ^ 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 trafalet.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: trafalet.cpp:43:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum1=max(sum1,0); ^ trafalet.cpp:46:32: error: no matching function for call to 'max(long long int&, int)' sum2=max(sum2,0); ^ trafalet.cpp:46:32: 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 trafalet.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: trafalet.cpp:46:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum2=max(sum2,0); ^ 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 trafalet.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: trafalet.cpp:46:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') sum2=max(sum2,0); ^ 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 trafalet.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: trafalet.cpp:46:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum2=max(sum2,0); ^ 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 trafalet.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: trafalet.cpp:46:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' sum2=max(sum2,0); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema trafalet 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ă.