#2220
Se consideră un șir a[1], a[2], …, a[n] de numere întregi. Să se determine diferența maximă de forma a[i] - a[j], unde 1 ≤ i < j ≤ n.
-
| Problema | DifMax | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.15 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64865017 | Utilizator | |
| Fișier | difmax.cpp | Dimensiune | 832 B |
| Data încărcării | 08 Iunie 2026, 11:37 | Scor/rezultat | Eroare de compilare |
difmax.cpp:2:7: error: ‘nmax’ was not declared in this scope 2 | int a[nmax], s[nmax], d[nmax], n; | ^~~~ difmax.cpp:2:16: error: ‘nmax’ was not declared in this scope 2 | int a[nmax], s[nmax], d[nmax], n; | ^~~~ difmax.cpp:2:25: error: ‘nmax’ was not declared in this scope 2 | int a[nmax], s[nmax], d[nmax], n; | ^~~~ difmax.cpp: In function ‘int main()’: difmax.cpp:7:5: error: ‘cin’ was not declared in this scope 7 | cin >> n; | ^~~ difmax.cpp:9:16: error: ‘a’ was not declared in this scope 9 | cin >> a[i]; | ^ difmax.cpp:13:5: error: ‘s’ was not declared in this scope 13 | s[1] = a[1]; | ^ difmax.cpp:13:12: error: ‘a’ was not declared in this scope 13 | s[1] = a[1]; | ^ difmax.cpp:15:16: error: ‘max’ was not declared in this scope 15 | s[i] = max(s[i - 1], a[i]); | ^~~ difmax.cpp:19:5: error: ‘d’ was not declared in this scope 19 | d[n] = a[n]; | ^ difmax.cpp:21:16: error: ‘min’ was not declared in this scope; did you mean ‘main’? 21 | d[i] = min(d[i + 1], a[i]); | ^~~ | main difmax.cpp:28:13: error: ‘max’ was not declared in this scope 28 | M = max(M, s[i] - d[i + 1]); | ^~~ difmax.cpp:30:5: error: ‘cout’ was not declared in this scope 30 | cout << M; | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DifMax 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ă.