#2637
ZOO
Intr-o gradina zoologica reprezentata printr-o matrice A
cu n
linii si m
coloane. Fiecare cusca se afla intr-o pozitie din matrice si contine x
animale. De exemplu daca A[2][6] = 5
inseamna ca in cusca de pe linia 2
si coloana 6
se afla 5
animale. Sa se raspunda la Q
intrebari de forma i1, j1, i2, j2
unde raspunsul va fi numarul de animale din dreptunghiul din matrice cu cordonatele coltului din stanga sus i1 si j1
si cordonatele coltului din dreapta jos i2 si j2
, unde i
reprezinta linia si j
coloana.
-
Problema | ZOO | Operații I/O |
![]() zoo.in /zoo.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57955762 | Utilizator | |
Fișier | zoo.cpp | Dimensiune | 631 B |
Data încărcării | 05 Mai 2025, 11:23 | Scor / rezultat | Eroare de compilare |
zoo.cpp:4:20: error: no matching function for call to 'std::basic_iostream<char>::basic_iostream(const char [7])' iostream f("zoo.in"); ^ zoo.cpp:4:20: note: candidates are: In file included from /usr/include/c++/4.8/fstream:38:0, from zoo.cpp:1: /usr/include/c++/4.8/istream:830:7: note: std::basic_iostream<_CharT, _Traits>::basic_iostream() [with _CharT = char; _Traits = std::char_traits<char>] basic_iostream() ^ /usr/include/c++/4.8/istream:830:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/4.8/istream:820:7: note: std::basic_iostream<_CharT, _Traits>::basic_iostream(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>] basic_iostream(basic_streambuf<_CharT, _Traits>* __sb) ^ /usr/include/c++/4.8/istream:820:7: note: no known conversion for argument 1 from 'const char [7]' to 'std::basic_streambuf<char>*' zoo.cpp:6:35: error: conflicting declaration 'long long int g' long long n,i,j,i1,i2,j1,s=0,k,j2,g,m,a[101][101],b[101][101]; ^ zoo.cpp:5:10: error: 'g' has a previous declaration as 'std::ofstream g' ofstream g("zoo.out"); ^ zoo.cpp: In function 'int main()': zoo.cpp:18:10: error: invalid user-defined conversion from 'std::ofstream {aka std::basic_ofstream<char>}' to 'long long int' [-fpermissive] for(i=g;i<=n;i++) ^ In file included from /usr/include/c++/4.8/ios:44:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/basic_ios.h:115:7: note: candidate is: std::basic_ios<_CharT, _Traits>::operator void*() const [with _CharT = char; _Traits = std::char_traits<char>] <near match> operator void*() const ^ /usr/include/c++/4.8/bits/basic_ios.h:115:7: note: no known conversion for implicit 'this' parameter from 'void*' to 'long long int' zoo.cpp:19:14: error: invalid user-defined conversion from 'std::ofstream {aka std::basic_ofstream<char>}' to 'long long int' [-fpermissive] for(j=g;j<=m;j++) ^ In file included from /usr/include/c++/4.8/ios:44:0, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/basic_ios.h:115:7: note: candidate is: std::basic_ios<_CharT, _Traits>::operator void*() const [with _CharT = char; _Traits = std::char_traits<char>] <near match> operator void*() const ^ /usr/include/c++/4.8/bits/basic_ios.h:115:7: note: no known conversion for implicit 'this' parameter from 'void*' to 'long long int' zoo.cpp:21:12: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' f>>g; ^ In file included from /usr/include/c++/4.8/fstream:38:0, from zoo.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 = std::basic_ofstream<char>]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ zoo.cpp:22:18: error: no match for 'operator<=' (operand types are 'long long int' and 'std::ofstream {aka std::basic_ofstream<char>}') for(k=1;k<=g;k++) ^ zoo.cpp:22:18: note: candidates are: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:239:5: note: template<class _T1, class _T2> constexpr bool std::operator<=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:239:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const std::pair<_T1, _T2>' and 'long long int' for(k=1;k<=g;k++) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67: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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:315:5: note: template<class _Iterator> bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator<=(const reverse_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:315:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int' for(k=1;k<=g;k++) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67: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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:365:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator<=(const reverse_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:365:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int' for(k=1;k<=g;k++) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67: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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1067:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<=(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&) operator<=(const move_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1067:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const std::move_iterator<_Iterator>' and 'long long int' for(k=1;k<=g;k++) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67: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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1073:5: note: template<class _Iterator> bool std::operator<=(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&) operator<=(const move_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1073:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const std::move_iterator<_Iterator>' and 'long long int' for(k=1;k<=g;k++) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2643:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2643:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'long long int' for(k=1;k<=g;k++) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2655:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2655:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'long long int' for(k=1;k<=g;k++) ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from zoo.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2667:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<=(const _CharT* __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2667:5: note: template argument deduction/substitution failed: zoo.cpp:22:20: note: mismatched types 'const _CharT*' and 'long long int' for(k=1;k<=g;k++) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ZOO 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ă.