#4605
Se cunosc înălțimile a N vârfuri, plasate de la stânga la dreapta, în cadrul unui lanț muntos. Dacă plasăm o santinelă pe un vârf de o anumită înălțime, aceasta veghează vârful respectiv și maximum K vârfuri la stânga și maximum K vârfuri la dreapta acestuia, dar cu condiția ca înălțimile acestor vârfuri vegheate să fie mai mici sau egale cu înălțimea vârfului pe care se află santinela. Date fiind N, K și înălțimile celor N vârfuri, să se determine:
OJI 2024, clasa a 9-a
| Problema | santinele | Operații I/O |
santinele.in/santinele.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 128 MB
/
Stivă 8 MB
|
| Id soluție | #64484372 | Utilizator | |
| Fișier | santinele.cpp | Dimensiune | 1.94 KB |
| Data încărcării | 10 Mai 2026, 14:14 | Scor/rezultat | 33 puncte |
santinele.cpp: In function ‘int main()’: santinele.cpp:14:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 14 | for( int i = 0; i < n; i++ ) | ^~~ santinele.cpp:17:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 17 | for( int i = 1; i <= k; i++ ) { | ^~~ santinele.cpp:49:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 49 | for (int i = n - 1 ; i >= 0 ; i--) | ^~~ santinele.cpp:56:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 56 | while( n > 0 ) { | ^~~~~ santinele.cpp:10:42: warning: unused variable ‘cnt’ [-Wunused-variable] 10 | int c = 0, n = 0, k = 0, maxim = -1, cnt = 1, minim = 1; | ^~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.003 secunde | OK. | 4 | 4 | ||
| 2 | 0.001 secunde | OK. | 5 | 5 | ||
| 3 | 0.002 secunde | OK. | 5 | 5 | ||
| 4 | 0.001 secunde | OK. | 2 | 2 | ||
| 5 | 0.001 secunde | OK. | 3 | 3 | ||
| 6 | 0.009 secunde | Raspuns gresit. | 3 | 0 | ||
| 7 | 0.041 secunde | Raspuns gresit. | 3 | 0 | ||
| 8 | Depășit | Limita de timp depășită | 3 | 0 | ||
| 9 | 0.001 secunde | OK. | 4 | 4 | ||
| 10 | 0.001 secunde | OK. | 4 | 4 | ||
| 11 | 0.015 secunde | OK. | 4 | 4 | ||
| 12 | Depășit | Limita de timp depășită | 4 | 0 | ||
| 13 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 14 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| 15 | 0.015 secunde | Raspuns gresit. | 5 | 0 | ||
| 16 | 0.001 secunde | Raspuns gresit. | 2 | 0 | ||
| 17 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 18 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 19 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 20 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 21 | 0.002 secunde | Raspuns gresit. | 1 | 0 | ||
| 22 | 0.001 secunde | OK. | 1 | 1 | ||
| 23 | 0.001 secunde | Raspuns gresit. | 1 | 0 | ||
| 24 | 0.001 secunde | Raspuns gresit. | 1 | 0 | ||
| 25 | 0.003 secunde | Raspuns gresit. | 1 | 0 | ||
| 26 | 0.008 secunde | Raspuns gresit. | 1 | 0 | ||
| 27 | 0.014 secunde | Raspuns gresit. | 1 | 0 | ||
| 28 | 0.025 secunde | Raspuns gresit. | 1 | 0 | ||
| 29 | 0.023 secunde | OK. | 1 | 1 | ||
| 30 | Depășit | Limita de timp depășită | 1 | 0 | ||
| 31 | Depășit | Limita de timp depășită | 1 | 0 | ||
| 32 | 0.065 secunde | Raspuns gresit. | 2 | 0 | ||
| 33 | Depășit | Limita de timp depășită | 2 | 0 | ||
| 34 | 0.099 secunde | Raspuns gresit. | 2 | 0 | ||
| 35 | Depășit | Limita de timp depășită | 2 | 0 | ||
| 36 | Depășit | Limita de timp depășită | 2 | 0 | ||
| 37 | Depășit | Limita de timp depășită | 2 | 0 | ||
| 38 | Depășit | Limita de timp depășită | 2 | 0 | ||
| 39 | Depășit | Limita de timp depășită | 2 | 0 | ||
| 40 | Depășit | Limita de timp depășită | 2 | 0 | ||
| Punctaj total | 33 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema santinele 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ă.