#4378
HarapAlb
Dându-se un șir A
de N
numere naturale nenule numerotate de la 1
la N
, să se determine câte subsecvențe [L,R]
cu 1 < L ≤ R < N
există, astfel încât elementele A[L], A[L+1],…, A[R]
să fie strict mai mari decât elementele A[L-1]
și A[R+1]
. De asemenea, se cere și determinarea lungimii maxime a unei astfel de secvențe. Scrieți un program care să rezolve următoarele două cerințe:
1) Să se determine lungimea maximă a unei subsecvențe ce respectă proprietatea din enunț;
2) Să se determine numărul de subsecvențe ce respectă proprietatea din enunț.
Problema | HarapAlb | Operații I/O |
harapalb.in /harapalb.out
|
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 512 MB
/
Stivă 64 MB
|
Id soluție | #50219718 | Utilizator | |
Fișier | harapalb.cpp | Dimensiune | 2.50 KB |
Data încărcării | 01 Aprilie 2024, 11:19 | Scor / rezultat | Eroare de compilare |
harapalb.cpp:60:17: error: stray '#' in program if (#include <iostream> ^ harapalb.cpp: In function 'int comp(abc, abc)': harapalb.cpp:12:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses] return a.st<b.st || a.st==b.st && a.dr<b.dr; ^ harapalb.cpp: In function 'int main()': harapalb.cpp:60:18: error: 'include' was not declared in this scope if (#include <iostream> ^ harapalb.cpp:60:35: error: expected primary-expression before '>' token if (#include <iostream> ^ harapalb.cpp:63:1: error: expected primary-expression before 'using' using namespace std; ^ harapalb.cpp:63:1: error: expected ')' before 'using' harapalb.cpp:70:1: error: a function-definition is not allowed here before '{' token { ^ harapalb.cpp:74:1: error: a function-definition is not allowed here before '{' token { ^ harapalb.cpp:130:1: error: expected '}' at end of input } ^ harapalb.cpp:66:5: warning: unused variable 'cer' [-Wunused-variable] int cer,n,k,st[10000010],v[10000010]; ^ harapalb.cpp:66:9: warning: unused variable 'n' [-Wunused-variable] int cer,n,k,st[10000010],v[10000010]; ^ harapalb.cpp:66:11: warning: unused variable 'k' [-Wunused-variable] int cer,n,k,st[10000010],v[10000010]; ^ harapalb.cpp:66:13: warning: unused variable 'st' [-Wunused-variable] int cer,n,k,st[10000010],v[10000010]; ^ harapalb.cpp:66:26: warning: unused variable 'v' [-Wunused-variable] int cer,n,k,st[10000010],v[10000010]; ^ harapalb.cpp:68:12: warning: unused variable 'a' [-Wunused-variable] int st,dr;}a[1000001]; ^ harapalb.cpp:57:13: warning: unused variable 'nr' [-Wunused-variable] int nr=0; ^ harapalb.cpp:130:1: error: expected '}' at end of input } ^ harapalb.cpp:18:9: warning: unused variable 'secv' [-Wunused-variable] int secv=0,mx=0; ^ harapalb.cpp:18:16: warning: unused variable 'mx' [-Wunused-variable] int secv=0,mx=0; ^ harapalb.cpp:130:1: error: expected '}' at end of input } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema HarapAlb 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ă.