#878
Intervale4
Se consideră un șir de n
intervale închise întregi. Două intervale consecutive în șir care au intersecția nevidă se reunesc și se înlocuiesc în șir cu intervalul reuniune. Operația se repetă până când nu mai sunt în șir două intervale consecutive cu intersecția nevidă.
Să se determine câte intervale există în șir după realizarea acestor operații.
Problema | Intervale4 | Operații I/O |
intervale4.in /intervale4.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51024749 | Utilizator | |
Fișier | intervale4.cpp | Dimensiune | 1.06 KB |
Data încărcării | 20 Mai 2024, 09:49 | Scor / rezultat | Eroare de compilare |
intervale4.cpp: In function 'int top()': intervale4.cpp:29:16: error: cannot convert 'st' to 'int' in return return S[vf]; ^ intervale4.cpp: In function 'int main()': intervale4.cpp:46:32: warning: operation on 'vf' may be undefined [-Wsequence-point] fin>>S[++vf].x>>S[vf].y; ^ intervale4.cpp:56:17: error: request for member 'x' in 'top()', which is of non-class type 'int' x=top().x; ^ intervale4.cpp:57:17: error: request for member 'y' in 'top()', which is of non-class type 'int' y=top().y; ^ intervale4.cpp:59:20: error: request for member 'x' in 'top()', which is of non-class type 'int' if(y<top().x || top().y<x) ^ intervale4.cpp:59:31: error: request for member 'y' in 'top()', which is of non-class type 'int' if(y<top().x || top().y<x) ^ intervale4.cpp:65:24: error: request for member 'x' in 'top()', which is of non-class type 'int' if(x<top().x) ^ intervale4.cpp:67:23: error: request for member 'x' in 'top()', which is of non-class type 'int' top().x=x; ^ intervale4.cpp:69:24: error: request for member 'y' in 'top()', which is of non-class type 'int' if(y<top().y) ^ intervale4.cpp:71:23: error: request for member 'y' in 'top()', which is of non-class type 'int' top().y=y; ^ intervale4.cpp: In function 'int top()': intervale4.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Intervale4 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ă.