#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 | #36875567 | Utilizator | |
Fișier | zoo.cpp | Dimensiune | 638 B |
Data încărcării | 28 Mai 2022, 10:30 | Scor / rezultat | Eroare de compilare |
zoo.cpp:5:61: error: 'long long int j1' redeclared as different kind of symbol long long n , m , a[105][105] , s[105][105] , p , i1 , i2 , j1 , j2; ^ 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 zoo.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:238:1: error: previous declaration of 'double j1(double)' __MATHCALL (j1,, (_Mdouble_)); ^ zoo.cpp: In function 'int main()': zoo.cpp:8:5: error: reference to 'cin' is ambiguous cin >> n >> m; ^ zoo.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("zoo.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from zoo.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ zoo.cpp:11:13: error: reference to 'cin' is ambiguous cin >> a[i][j]; ^ zoo.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("zoo.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from zoo.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ zoo.cpp:15:5: error: reference to 'cin' is ambiguous cin >> p; ^ zoo.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("zoo.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from zoo.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ zoo.cpp:18:9: error: reference to 'cin' is ambiguous cin >> i1 >> j1 >> i2 >> j2; ^ zoo.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("zoo.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from zoo.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ zoo.cpp:19:9: error: reference to 'cout' is ambiguous cout << s[i2][j2] - s[i1-1][j2] - s[i2][j1-1] + s[i1 - 1][j1 - 1]<< '\n'; ^ zoo.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("zoo.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from zoo.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ zoo.cpp:19:52: warning: pointer to a function used in arithmetic [-Wpointer-arith] cout << s[i2][j2] - s[i1-1][j2] - s[i2][j1-1] + s[i1 - 1][j1 - 1]<< '\n'; ^ zoo.cpp:19:53: error: invalid types 'long long int [105][double (*)(double)throw ()]' for array subscript cout << s[i2][j2] - s[i1-1][j2] - s[i2][j1-1] + s[i1 - 1][j1 - 1]<< '\n'; ^ zoo.cpp:19:72: warning: pointer to a function used in arithmetic [-Wpointer-arith] cout << s[i2][j2] - s[i1-1][j2] - s[i2][j1-1] + s[i1 - 1][j1 - 1]<< '\n'; ^ zoo.cpp:19:73: error: invalid types 'long long int [105][double (*)(double)throw ()]' for array subscript cout << s[i2][j2] - s[i1-1][j2] - s[i2][j1-1] + s[i1 - 1][j1 - 1]<< '\n'; ^
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ă.