#2902
Pavaj
Curtea bunicului are forma unei matrice cu n
linii și m
coloane și este pavată cu n*m
dale, o parte dintre acestea fiind deteriorate. Bunicul a realizat un plan al curții în care a marcat cu 0
dalele deteriorate și cu 1
pe cele nedeteriorate.
Bunicul a primit k
oferte pentru a vinde zone dreptunghiulare ale curții. Fiecare zonă este determinată de coordonatele l1 c1 l2 c2
a două colțuri opuse ale ei. Pentru fiecare zonă bunicul dorește să afle dacă conține doar dale nedeteriorate, doar dale deteriorate sau conține și dale deteriorate și dale nedeteriorate.
Problema | Pavaj | Operații I/O |
pavaj.in /pavaj.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 4 MB
/
Stivă 4 MB
|
Id soluție | #33868738 | Utilizator | |
Fișier | pavaj.cpp | Dimensiune | 1.20 KB |
Data încărcării | 11 Ianuarie 2022, 20:23 | Scor / rezultat | Eroare de compilare |
pavaj.cpp:5:38: error: 'int j1' redeclared as different kind of symbol int n , m , t , s[1001][1001] , i1 , j1 , i2 , 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 pavaj.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:238:1: error: previous declaration of 'double j1(double)' __MATHCALL (j1,, (_Mdouble_)); ^ pavaj.cpp: In function 'int main()': pavaj.cpp:8:5: error: reference to 'cin' is ambiguous cin >> n >> m >> t; ^ pavaj.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("pavaj.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from pavaj.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ pavaj.cpp:11:9: error: reference to 'cin' is ambiguous cin >> s[i][j]; ^ pavaj.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("pavaj.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from pavaj.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ pavaj.cpp:17:9: error: reference to 'cin' is ambiguous cin >> i1 >> j1 >> i2 >> j2; ^ pavaj.cpp:3:10: note: candidates are: std::ifstream cin ifstream cin("pavaj.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from pavaj.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ pavaj.cpp:19:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(i1 <= i2 && j1 <= j2) sum = s[i2][j2] - s[i1 - 1][j2] - s[i2][j1 - 1] + s[i1 - 1][j1 - 1] , nr = (j2 - j1 + 1) * (i2 - i1 + 1); ^ pavaj.cpp:19:79: warning: pointer to a function used in arithmetic [-Wpointer-arith] if(i1 <= i2 && j1 <= j2) sum = s[i2][j2] - s[i1 - 1][j2] - s[i2][j1 - 1] + s[i1 - 1][j1 - 1] , nr = (j2 - j1 + 1) * (i2 - i1 + 1); ^ pavaj.cpp:19:80: error: invalid types 'int [1001][double (*)(double)throw ()]' for array subscript if(i1 <= i2 && j1 <= j2) sum = s[i2][j2] - s[i1 - 1][j2] - s[i2][j1 - 1] + s[i1 - 1][j1 - 1] , nr = (j2 - j1 + 1) * (i2 - i1 + 1); ^ pavaj.cpp:19:99: warning: pointer to a function used in arithmetic [-Wpointer-arith] if(i1 <= i2 && j1 <= j2) sum = s[i2][j2] - s[i1 - 1][j2] - s[i2][j1 - 1] + s[i1 - 1][j1 - 1] , nr = (j2 - j1 + 1) * (i2 - i1 + 1); ^ pavaj.cpp:19:100: error: invalid types 'int [1001][double (*)(double)throw ()]' for array subscript if(i1 <= i2 && j1 <= j2) sum = s[i2][j2] - s[i1 - 1][j2] - s[i2][j1 - 1] + s[i1 - 1][j1 - 1] , nr = (j2 - j1 + 1) * (i2 - i1 + 1); ^ pavaj.cpp:19:115: error: invalid operands of types 'int' and 'double(double)throw ()' to binary 'operator-' if(i1 <= i2 && j1 <= j2) sum = s[i2][j2] - s[i1 - 1][j2] - s[i2][j1 - 1] + s[i1 - 1][j1 - 1] , nr = (j2 - j1 + 1) * (i2 - i1 + 1); ^ pavaj.cpp:20:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if(i1 >= i2 && j1 <= j2) sum = s[i1][j2] - s[i2 - 1][j2] - s[i1][j1 - 1] + s[i2 - 1][j1 - 1] , nr = (i1 - i2 + 1) * (j2 - j1 + 1); ^ pavaj.cpp:20:84: warning: pointer to a function used in arithmetic [-Wpointer-arith] else if(i1 >= i2 && j1 <= j2) sum = s[i1][j2] - s[i2 - 1][j2] - s[i1][j1 - 1] + s[i2 - 1][j1 - 1] , nr = (i1 - i2 + 1) * (j2 - j1 + 1); ^ pavaj.cpp:20:85: error: invalid types 'int [1001][double (*)(double)throw ()]' for array subscript else if(i1 >= i2 && j1 <= j2) sum = s[i1][j2] - s[i2 - 1][j2] - s[i1][j1 - 1] + s[i2 - 1][j1 - 1] , nr = (i1 - i2 + 1) * (j2 - j1 + 1); ^ pavaj.cpp:20:104: warning: pointer to a function used in arithmetic [-Wpointer-arith] else if(i1 >= i2 && j1 <= j2) sum = s[i1][j2] - s[i2 - 1][j2] - s[i1][j1 - 1] + s[i2 - 1][j1 - 1] , nr = (i1 - i2 + 1) * (j2 - j1 + 1); ^ pavaj.cpp:20:105: error: invalid types 'int [1001][double (*)(double)throw ()]' for array subscript else if(i1 >= i2 && j1 <= j2) sum = s[i1][j2] - s[i2 - 1][j2] - s[i1][j1 - 1] + s[i2 - 1][j1 - 1] , nr = (i1 - i2 + 1) * (j2 - j1 + 1); ^ pavaj.cpp:20:136: error: invalid operands of types 'int' and 'double(double)throw ()' to binary 'operator-' else if(i1 >= i2 && j1 <= j2) sum = s[i1][j2] - s[i2 - 1][j2] - s[i1][j1 - 1] + s[i2 - 1][j1 - 1] , nr = (i1 - i2 + 1) * (j2 - j1 + 1); ^ pavaj.cpp:21:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] else if(i1 <= i2 && j1 >= j2) sum = s[i2][j1] - s[i1 - 1][j1] - s[i2][j2 - 1] + s[i1 - 1][j2 - 1] , nr = (i2 - i1 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:21:53: error: invalid types 'int [1001][double(double)throw ()]' for array subscript else if(i1 <= i2 && j1 >= j2) sum = s[i2][j1] - s[i1 - 1][j1] - s[i2][j2 - 1] + s[i1 - 1][j2 - 1] , nr = (i2 - i1 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:21:69: error: invalid types 'int [1001][double(double)throw ()]' for array subscript else if(i1 <= i2 && j1 >= j2) sum = s[i2][j1] - s[i1 - 1][j1] - s[i2][j2 - 1] + s[i1 - 1][j2 - 1] , nr = (i2 - i1 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:21:136: warning: pointer to a function used in arithmetic [-Wpointer-arith] else if(i1 <= i2 && j1 >= j2) sum = s[i2][j1] - s[i1 - 1][j1] - s[i2][j2 - 1] + s[i1 - 1][j2 - 1] , nr = (i2 - i1 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:21:141: warning: pointer to a function used in arithmetic [-Wpointer-arith] else if(i1 <= i2 && j1 >= j2) sum = s[i2][j1] - s[i1 - 1][j1] - s[i2][j2 - 1] + s[i1 - 1][j2 - 1] , nr = (i2 - i1 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:21:142: error: invalid operands of types 'int' and 'double (*)(double)throw ()' to binary 'operator*' else if(i1 <= i2 && j1 >= j2) sum = s[i2][j1] - s[i1 - 1][j1] - s[i2][j2 - 1] + s[i1 - 1][j2 - 1] , nr = (i2 - i1 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:22:28: error: invalid types 'int [1001][double(double)throw ()]' for array subscript else sum = s[i1][j1] - s[i2 - 1][j1] - s[i1][j2 - 1] + s[i2 - 1][j2 - 1] , nr = (i1 - i2 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:22:44: error: invalid types 'int [1001][double(double)throw ()]' for array subscript else sum = s[i1][j1] - s[i2 - 1][j1] - s[i1][j2 - 1] + s[i2 - 1][j2 - 1] , nr = (i1 - i2 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:22:111: warning: pointer to a function used in arithmetic [-Wpointer-arith] else sum = s[i1][j1] - s[i2 - 1][j1] - s[i1][j2 - 1] + s[i2 - 1][j2 - 1] , nr = (i1 - i2 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:22:116: warning: pointer to a function used in arithmetic [-Wpointer-arith] else sum = s[i1][j1] - s[i2 - 1][j1] - s[i1][j2 - 1] + s[i2 - 1][j2 - 1] , nr = (i1 - i2 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:22:117: error: invalid operands of types 'int' and 'double (*)(double)throw ()' to binary 'operator*' else sum = s[i1][j1] - s[i2 - 1][j1] - s[i1][j2 - 1] + s[i2 - 1][j2 - 1] , nr = (i1 - i2 + 1) * (j1 - j2 + 1); ^ pavaj.cpp:23:22: error: reference to 'cout' is ambiguous if(sum == 0) cout << 0 << '\n'; ^ pavaj.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("pavaj.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from pavaj.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ pavaj.cpp:24:28: error: reference to 'cout' is ambiguous else if(sum == nr) cout << 1 << '\n'; ^ pavaj.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("pavaj.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from pavaj.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ pavaj.cpp:25:14: error: reference to 'cout' is ambiguous else cout << 2 << '\n'; ^ pavaj.cpp:4:10: note: candidates are: std::ofstream cout ofstream cout("pavaj.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from pavaj.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Pavaj 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ă.