#2818
Numim inserare a unui șir A într-un șir B introducerea, între două elemente ale șirului B, a tuturor elementelor lui A, pe poziții consecutive, în ordinea în care apar în A.
Se dau două șiruri cu n, respectiv m elemente numere întregi ordonate strict crescător, în care numerotarea elementelor începe de la 1.
Se cere să se afișeze poziția din al doilea șir începând de la care poate fi inserat primul șir, astfel încât șirul obținut să fie strict crescător. Dacă nu există o astfel de poziție, se afișează mesajul imposibil.
Subiect Bacalaureat 2017, sesiunea specială
| Problema | Inserare2 | Operații I/O |
inserare2.in/inserare2.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 2 MB
/
Stivă 2 MB
|
| Id soluție | #42127282 | Utilizator | |
| Fișier | inserare2.cpp | Dimensiune | 1.39 KB |
| Data încărcării | 18 Februarie 2023, 19:40 | Scor/rezultat | Eroare de compilare |
inserare2.cpp:49:13: error: redefinition of 'std::ifstream fin' ifstream fin("inserare2.in"); ^ inserare2.cpp:4:10: error: 'std::ifstream fin' previously declared here ifstream fin("inserare2.in"); ^ inserare2.cpp:50:14: error: redefinition of 'std::ofstream fout' ofstream fout("inserare2.out"); ^ inserare2.cpp:5:10: error: 'std::ofstream fout' previously declared here ofstream fout("inserare2.out"); ^ inserare2.cpp:51:5: error: redefinition of 'int n' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:5: error: 'int n' previously declared here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:8: error: redefinition of 'int m' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:8: error: 'int m' previously declared here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:11: error: redefinition of 'int minim' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:11: error: 'int minim' previously defined here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:27: error: redefinition of 'int x' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:27: error: 'int x' previously declared here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:30: error: redefinition of 'int ind' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:30: error: 'int ind' previously defined here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:39: error: redefinition of 'int ok' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:39: error: 'int ok' previously declared here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:43: error: redefinition of 'int maxim' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:43: error: 'int maxim' previously defined here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:55: error: redefinition of 'int y' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:55: error: 'int y' previously declared here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:51:58: error: redefinition of 'int nr' int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:6:58: error: 'int nr' previously declared here int n, m, minim = 999999, x, ind = 1, ok, maxim = -1, y, nr; ^ inserare2.cpp:52:6: error: redefinition of 'bool g' bool g = false; ^ inserare2.cpp:7:6: error: 'bool g' previously defined here bool g = false; ^ inserare2.cpp: In function 'int main()': inserare2.cpp:53:5: error: redefinition of 'int main()' int main() ^ inserare2.cpp:8:5: error: 'int main()' previously defined here int main() ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Inserare2 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ă.