#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 | #57394599 | Utilizator | |
Fișier | santinele.cpp | Dimensiune | 1007 B |
Data încărcării | 28 Martie 2025, 20:41 | Scor / rezultat | 29 puncte |
santinele.cpp: In function 'int main()': santinele.cpp:9:22: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(f,"%d",&c); ^ santinele.cpp:10:27: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(f,"%d%d",&n,&k); ^ santinele.cpp:15:33: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(f,"%d",&a[i]); ^ santinele.cpp:37:30: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(f,"%d",&b); ^ santinele.cpp:45:18: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized] int s1=(n-x)/(k+1); ^ santinele.cpp:8:25: warning: 'poz' may be used uninitialized in this function [-Wmaybe-uninitialized] int n,k,max=-1,nr=0,poz; ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 4 | 4 | ||
2 | 0 secunde | OK. | 5 | 5 | ||
3 | 0 secunde | OK. | 5 | 5 | ||
4 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
5 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
6 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
7 | 0.004 secunde | OK. | 3 | 3 | ||
8 | 0.008 secunde | Raspuns gresit. | 3 | 0 | ||
9 | 0 secunde | Raspuns gresit. | 4 | 0 | ||
10 | 0 secunde | Raspuns gresit. | 4 | 0 | ||
11 | 0 secunde | Raspuns gresit. | 4 | 0 | ||
12 | 0.004 secunde | Raspuns gresit. | 4 | 0 | ||
13 | 0 secunde | Raspuns gresit. | 4 | 0 | ||
14 | 0 secunde | Raspuns gresit. | 4 | 0 | ||
15 | 0 secunde | Raspuns gresit. | 5 | 0 | ||
16 | 0 secunde | OK. | 2 | 2 | ||
17 | 0 secunde | OK. | 3 | 3 | ||
18 | 0 secunde | OK. | 3 | 3 | ||
19 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
20 | 0 secunde | OK. | 3 | 3 | ||
21 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
22 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
23 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
24 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
25 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
26 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
27 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
28 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
29 | 0 secunde | OK. | 1 | 1 | ||
30 | 0 secunde | Raspuns gresit. | 1 | 0 | ||
31 | 0.004 secunde | Raspuns gresit. | 1 | 0 | ||
32 | 0.004 secunde | Raspuns gresit. | 2 | 0 | ||
33 | 0.004 secunde | Raspuns gresit. | 2 | 0 | ||
34 | 0.004 secunde | Raspuns gresit. | 2 | 0 | ||
35 | 0.004 secunde | Raspuns gresit. | 2 | 0 | ||
36 | 0.004 secunde | Raspuns gresit. | 2 | 0 | ||
37 | 0.004 secunde | Raspuns gresit. | 2 | 0 | ||
38 | 0.008 secunde | Raspuns gresit. | 2 | 0 | ||
39 | 0.008 secunde | Raspuns gresit. | 2 | 0 | ||
40 | 0.008 secunde | Raspuns gresit. | 2 | 0 | ||
Punctaj total | 29 |
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ă.