#2650
Eroul nostru, Căldărușe, are un număr n
de cărți pe care le are aranjate una peste cealaltă (sub forma unui stack). Cartea din vârf are valoarea \( {a}_{1} \), următoarea \( {a}_{2} \) și așa mai departe. Cartea de la bază are indicele n
(\( {a}_{n} \)). Toate numerele sunt distincte. Căldărușe vrea să mute toate cărțile în ghiozdanul lui în exact n
pași. În timpul pasului de ordin i
, el vrea să mute cartea cu numărul \( {b}_{i} \) în ghiozdan. Dacă această carte se află în stack, el o ia atât pe ea, cât și toate cărțile situate deasupra acesteia și le pune în ghiozdan; în caz contrar, el nu va face nimic și va trece la următorul pas. Ajutați-l pe Căldărușe! Spuneți-i voi numărul de cărți pe care le va pune în ghiozdan în timpul fiecărui pas.
Problema | books | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58247699 | Utilizator | |
Fișier | books.cpp | Dimensiune | 1.65 KB |
Data încărcării | 22 Mai 2025, 10:34 | Scor / rezultat | Eroare de compilare |
books.cpp:39:13: error: redefinition of 'int s [200001]' int s[200001],vf =0; // stiva manuala, vf = varful stivei ^ books.cpp:3:5: error: 'int s [200001]' previously declared here int s[200001],vf =0; // stiva manuala, vf = varful stivei ^ books.cpp:39:15: error: redefinition of 'int vf' int s[200001],vf =0; // stiva manuala, vf = varful stivei ^ books.cpp:3:15: error: 'int vf' previously defined here int s[200001],vf =0; // stiva manuala, vf = varful stivei ^ books.cpp:40:13: error: redefinition of 'int f [200001]' int f[200001];//f[x]=1 dacă x e deja mutată ^ books.cpp:4:5: error: 'int f [200001]' previously declared here int f[200001];//f[x]=1 dacă x e deja mutată ^ books.cpp:41:5: error: redefinition of 'int n' int n,v[200001],i,x,ct,top; ^ books.cpp:5:5: error: 'int n' previously declared here int n,v[200001],i,x,ct,top; ^ books.cpp:41:15: error: redefinition of 'int v [200001]' int n,v[200001],i,x,ct,top; ^ books.cpp:5:7: error: 'int v [200001]' previously declared here int n,v[200001],i,x,ct,top; ^ books.cpp:41:17: error: redefinition of 'int i' int n,v[200001],i,x,ct,top; ^ books.cpp:5:17: error: 'int i' previously declared here int n,v[200001],i,x,ct,top; ^ books.cpp:41:19: error: redefinition of 'int x' int n,v[200001],i,x,ct,top; ^ books.cpp:5:19: error: 'int x' previously declared here int n,v[200001],i,x,ct,top; ^ books.cpp:41:21: error: redefinition of 'int ct' int n,v[200001],i,x,ct,top; ^ books.cpp:5:21: error: 'int ct' previously declared here int n,v[200001],i,x,ct,top; ^ books.cpp:41:24: error: redefinition of 'int top' int n,v[200001],i,x,ct,top; ^ books.cpp:5:24: error: 'int top' previously declared here int n,v[200001],i,x,ct,top; ^ books.cpp: In function 'int main()': books.cpp:42:5: error: redefinition of 'int main()' int main() ^ books.cpp:6:5: error: 'int main()' previously defined here int main() ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema books 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ă.