#4088
Se consideră un șir A, inițial vid. Asupra lui A se aplică n operații de două tipuri:
1 x – adaugă numărul x în A2 k – dacă A ar fi ordonat crescător, care ar fi a k-a valoare?Să se răspundă la cele n întrebări.
Folclorul informatic
| Problema | BSTQ | Operații I/O |
bstq.in/bstq.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 128 MB
/
Stivă 64 MB
|
| Id soluție | #64517172 | Utilizator | |
| Fișier | bstq.cpp | Dimensiune | 1.32 KB |
| Data încărcării | 12 Mai 2026, 10:18 | Scor/rezultat | Eroare de compilare |
bstq.cpp: In function ‘void inserare(nod*&, int)’: bstq.cpp:32:28: error: expected ‘;’ before ‘:’ token 32 | rad->nrNodArb++: | ^ | ; bstq.cpp:39:13: error: ‘i’ was not declared in this scope 39 | i | ^ bstq.cpp: In function ‘int afisare(nod*, int)’: bstq.cpp:50:13: warning: statement has no effect [-Wunused-value] 50 | nrdr-rad->dr->nrNodArb; | ~~~~^~~~~~~~~~~~~~~~~~ bstq.cpp:54:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 54 | if(k=nrst) | ~^~~~~ bstq.cpp:57:38: error: expected primary-expression before ‘)’ token 57 | return afisare(rad->dr,k-) | ^ bstq.cpp:57:39: error: expected ‘;’ before ‘}’ token 57 | return afisare(rad->dr,k-) | ^ | ; 58 | } | ~ bstq.cpp: In function ‘int main()’: bstq.cpp:61:10: error: ‘n’ was not declared in this scope 61 | cin>>n; | ^ bstq.cpp:65:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 65 | if(op==1;) | ^~ bstq.cpp:65:14: warning: statement has no effect [-Wunused-value] 65 | if(op==1;) | ~~^~~ bstq.cpp:65:18: error: expected primary-expression before ‘)’ token 65 | if(op==1;) | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BSTQ 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ă.