#3359
Se dă un șir de n numere naturale. Determinați o pereche de numere consecutive în șir, cu proprietatea că au exact aceiași factori primi, indiferent de ordine. Dacă sunt mai multe asemenea perechi se va determina aceea cu suma numerelor mai mare. Dacă în continuare sunt mai multe perechi, se va determina prima din șir.
| Problema | Pereche1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64428288 | Utilizator | |
| Fișier | pereche1.cpp | Dimensiune | 1.21 KB |
| Data încărcării | 06 Mai 2026, 13:09 | Scor/rezultat | 100 puncte |
In file included from /usr/include/c++/13/algorithm:61, from pereche1.cpp:3: In function ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’, inlined from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/13/bits/stl_algo.h:1854:5, inlined from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/13/bits/stl_algo.h:1950:31, inlined from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/13/bits/stl_algo.h:1942:5, inlined from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = int*]’ at /usr/include/c++/13/bits/stl_algo.h:4861:18, inlined from ‘int main()’ at pereche1.cpp:49:11: /usr/include/c++/13/bits/stl_algo.h:1859:32: warning: array subscript 17 is outside array bounds of ‘int [10]’ [-Warray-bounds=] 1859 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pereche1.cpp: In function ‘int main()’: pereche1.cpp:5:14: note: at offset 68 into object ‘a’ of size 40 5 | int n, x, y, a[10], b[10], a1=1, b1=1, xmax=-1, ymax=-1, x1, y1; | ^ In function ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’, inlined from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/13/bits/stl_algo.h:1854:5, inlined from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/13/bits/stl_algo.h:1950:31, inlined from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/13/bits/stl_algo.h:1942:5, inlined from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = int*]’ at /usr/include/c++/13/bits/stl_algo.h:4861:18, inlined from ‘int main()’ at pereche1.cpp:50:11: /usr/include/c++/13/bits/stl_algo.h:1859:32: warning: array subscript 17 is outside array bounds of ‘int [10]’ [-Warray-bounds=] 1859 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pereche1.cpp: In function ‘int main()’: pereche1.cpp:5:21: note: at offset 68 into object ‘b’ of size 40 5 | int n, x, y, a[10], b[10], a1=1, b1=1, xmax=-1, ymax=-1, x1, y1; | ^ In function ‘void reset(int*)’, inlined from ‘int main()’ at pereche1.cpp:58:14: pereche1.cpp:11:13: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [40, 43] is out of the bounds [0, 40] of object ‘a’ with type ‘int [10]’ [-Warray-bounds=] 11 | v[i]=0; | ~~~~^~ pereche1.cpp: In function ‘int main()’: pereche1.cpp:5:14: note: ‘a’ declared here 5 | int n, x, y, a[10], b[10], a1=1, b1=1, xmax=-1, ymax=-1, x1, y1; | ^ In function ‘void reset(int*)’, inlined from ‘int main()’ at pereche1.cpp:59:14: pereche1.cpp:11:13: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [40, 43] is out of the bounds [0, 40] of object ‘b’ with type ‘int [10]’ [-Warray-bounds=] 11 | v[i]=0; | ~~~~^~ pereche1.cpp: In function ‘int main()’: pereche1.cpp:5:21: note: ‘b’ declared here 5 | int n, x, y, a[10], b[10], a1=1, b1=1, xmax=-1, ymax=-1, x1, y1; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | OK. | 20 | 20 | ||
| 3 | 0.001 secunde | OK. | 20 | 20 | ||
| 4 | 0.02 secunde | OK. | 20 | 20 | ||
| 5 | 0.017 secunde | OK. | 20 | 20 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Pereche1 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ă.