#3779
umede
În sistemul de axe xOy
se consideră N
etajere fixate paralel cu axa Ox
. Etajerele sunt descrise prin tripletul de numere naturale nenule: x1 x2 y
, unde x1
, x2
– reprezintă extremitățile stânga, respectiv dreapta ale etajerei, iar y
e înălțimea la care etajera este fixată. Etajerele nu se suprapun (nu au puncte comune). Dintr-un punct de coordonate întregi (X, Y)
, superior tuturor etajerelor, curge apă de la un robinet. Dacă apa ajunge pe o etajeră, aceasta se prelinge pe etajeră spre extremități. Astfel, dacă apa atinge etajera descrisă prin (x1, x2, y)
, aceasta se deplasează în ambele sensuri către extremitățile etajerei de unde va cădea vertical pe direcțiile x1
, respectiv x2
, până când atinge fie o altă etajeră, fie podeaua (y = 0
). Să se determine:
a) câte etajere nu sunt atinse de apă (nu sunt umede)
b) numărul maxim de etajere ce au fost umezite, aflate pe o aceeași axă verticală paralelă cu Oy
.
Problema | umede | Operații I/O |
umede.in /umede.out
|
---|---|---|---|
Limita timp | 0.15 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #29855729 | Utilizator | |
Fișier | umede.cpp | Dimensiune | 1.15 KB |
Data încărcării | 26 Mai 2021, 10:47 | Scor / rezultat | Eroare de compilare |
umede.cpp:10:20: error: expected ')' before 'x' bool between(floor x, std::pair<int,int> y) { ^ umede.cpp:10:42: error: expected primary-expression before 'y' bool between(floor x, std::pair<int,int> y) { ^ umede.cpp:10:43: error: expression list treated as compound expression in initializer [-fpermissive] bool between(floor x, std::pair<int,int> y) { ^ umede.cpp:10:45: error: expected ',' or ';' before '{' token bool between(floor x, std::pair<int,int> y) { ^ umede.cpp:14:50: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' int colidecount(int wx, int wy, std::vector<floor> floors) { ^ umede.cpp:14:50: error: expected a type, got 'floor' umede.cpp:14:50: error: template argument 2 is invalid umede.cpp: In function 'int colidecount(int, int, int)': umede.cpp:19:15: error: expected ';' before 'res' floor res = std::find(floors.begin(), floors.end(), p); ^ umede.cpp:19:63: warning: statement is a reference, not call, to function 'floor' [-Waddress] floor res = std::find(floors.begin(), floors.end(), p); ^ umede.cpp:19:63: warning: statement has no effect [-Wunused-value] umede.cpp:20:12: error: 'res' was not declared in this scope if(res != floors.end()) { ^ umede.cpp:20:26: error: request for member 'end' in 'floors', which is of non-class type 'int' if(res != floors.end()) { ^ umede.cpp:21:54: error: expected ';' before ')' token return colidecount(res.x1, res.y), floors) + ^ umede.cpp:21:54: error: expected primary-expression before ')' token umede.cpp:21:54: error: expected ';' before ')' token umede.cpp: At global scope: umede.cpp:27:15: error: 'floor' does not name a type bool gt(const floor x, const floor y){ ^ umede.cpp:27:21: error: ISO C++ forbids declaration of 'x' with no type [-fpermissive] bool gt(const floor x, const floor y){ ^ umede.cpp:27:30: error: 'floor' does not name a type bool gt(const floor x, const floor y){ ^ umede.cpp:27:36: error: ISO C++ forbids declaration of 'y' with no type [-fpermissive] bool gt(const floor x, const floor y){ ^ umede.cpp: In function 'bool gt(int, int)': umede.cpp:28:14: error: request for member 'y' in 'x', which is of non-class type 'const int' return x.y > y.y; ^ umede.cpp:28:20: error: request for member 'y' in 'y', which is of non-class type 'const int' return x.y > y.y; ^ umede.cpp: In function 'int main()': umede.cpp:39:22: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' std::vector<floor> floors; ^ umede.cpp:39:22: error: expected a type, got 'floor' umede.cpp:39:22: error: template argument 2 is invalid umede.cpp:39:30: error: invalid type in declaration before ';' token std::vector<floor> floors; ^ umede.cpp:42:27: error: invalid types 'int[int]' for array subscript reader >> floors[i].x1 >> floors[i].x2 >> floors[i].y; ^ umede.cpp:42:43: error: invalid types 'int[int]' for array subscript reader >> floors[i].x1 >> floors[i].x2 >> floors[i].y; ^ umede.cpp:42:59: error: invalid types 'int[int]' for array subscript reader >> floors[i].x1 >> floors[i].x2 >> floors[i].y; ^ umede.cpp:44:22: error: request for member 'begin' in 'floors', which is of non-class type 'int' std::sort(floors.begin(), floors.end(), gt); ^ umede.cpp:44:38: error: request for member 'end' in 'floors', which is of non-class type 'int' std::sort(floors.begin(), floors.end(), gt); ^ umede.cpp:47:27: error: request for member 'size' in 'floors', which is of non-class type 'int' for(int i=0; i<floors.size(); i++){ ^ umede.cpp:48:30: error: invalid types 'int[int]' for array subscript std::cout << floors[i].y << std::endl; ^ umede.cpp: In function 'int colidecount(int, int, int)': umede.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ umede.cpp: In function 'bool gt(int, int)': umede.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema umede 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ă.