#680
Se consideră un șir A
cu N
elemente întregi nenule. Numim secvență a șirului A
orice succesiune de elemente aflate pe poziții consecutive în șir: A
i
, A
i+1
, …, A
j
cu 1 ≤ i < j ≤ N
. Prin lungimea secvenței înțelegem numărul de elemente care o compun.
Pentru orice secvenţă A
i
, A
i+1
, …, A
j
, vom numi split-point un indice k
, i ≤ k < j
, care împarte secvența în două subsecvențe nevide: A
i
, A
i+1
, …, A
k
, respectiv A
k+1
, A
k+2
, …, A
j
.
Fie Dmax
valoarea absolută maximă a diferenței sumelor elementelor celor două subsecvențe separate de un split-point, luând în considerare toate secvenţele Ai,Ai+1,…,Aj
posibile şi fie Lmax
lungimea maximă a unei secvenţe caracterizată de valoarea Dmax
.
Cunoscând N
şi valorile elementelor şirului A
, să se determine Dmax
şi Lmax
.
Lot Juniori, Vaslui, 2014
Problema | ksplit | Operații I/O |
![]() ksplit.in /ksplit.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 8 MB
/
Stivă 8 MB
|
Id soluție | #55353165 | Utilizator | |
Fișier | ksplit.cpp | Dimensiune | 1.59 KB |
Data încărcării | 12 Ianuarie 2025, 14:20 | Scor / rezultat | 10 puncte |
ksplit.cpp: In function 'void formare_ssm(long long int, long long int, long long int)': ksplit.cpp:9:40: warning: variable 'pas' set but not used [-Wunused-but-set-variable] int i, sum = 0, start = prim, sgn, pas; ^ ksplit.cpp: At global scope: ksplit.cpp:24:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] main() ^ ksplit.cpp: In function 'int main()': ksplit.cpp:26:15: warning: unused variable 'start' [-Wunused-variable] int n, i, start, sum, sum1, sum2, dmax = -LLONG_MAX, lmax = -1; ^ ksplit.cpp:26:22: warning: unused variable 'sum' [-Wunused-variable] int n, i, start, sum, sum1, sum2, dmax = -LLONG_MAX, lmax = -1; ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
2 | 0 secunde | OK. | 5 | 5 | ||
3 | 0.012 secunde | OK. | 5 | 5 | ||
4 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
5 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
6 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
7 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
8 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
9 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
10 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
11 | 0.004 secunde | Raspuns gresit. | 5 | 0 | ||
12 | 0.004 secunde | Raspuns gresit. | 5 | 0 | ||
13 | 0.004 secunde | Raspuns gresit. | 5 | 0 | ||
14 | 0.004 secunde | Raspuns gresit. | 5 | 0 | ||
15 | 0.008 secunde | Raspuns gresit. | 5 | 0 | ||
16 | 0.008 secunde | Raspuns gresit. | 5 | 0 | ||
17 | 0.008 secunde | Raspuns gresit. | 5 | 0 | ||
18 | 0.016 secunde | Raspuns gresit. | 5 | 0 | ||
19 | 0.012 secunde | Raspuns gresit. | 5 | 0 | ||
20 | 0.016 secunde | Raspuns gresit. | 5 | 0 | ||
Punctaj total | 10 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ksplit 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ă.