#5001
Fermierul Amooot merge la magazinul de furaje pentru a achiziționa amestecuri de iarbă pentru pășunatul vacilor sale. Vânzătorul Popică, viclean de fel, îi prezintă un șir V de N oferte; însă, pentru ca Amooot să poată achiziționa hrana, acesta va trebui neapărat să selecteze o subsecvență canonică de oferte!
Spunem că o subsecvență A[i], A[i+1], … , A[j] , 1 ≤ i ≤ j ≤ N este canonică dacă A[k] % A[i] = 0, pentru orice k, i ≤ k ≤ j. De exemplu, în șirul (3, 4, 2, 10, 4, 12, 3), subsecvențe canonice sunt (2, 10) sau (2, 10, 4, 12), dar nu și subsecvența (10, 4, 12).
Văzând condițiile impuse de Popică, Amooot își pune două întrebări:
V?V?ONI 2026, clasa a 9-a
| Problema | Canonic | Operații I/O |
canonic.in/canonic.out
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 32 MB
/
Stivă 8 MB
|
| Id soluție | #64349588 | Utilizator | |
| Fișier | canonic.cpp | Dimensiune | 822 B |
| Data încărcării | 01 Mai 2026, 11:55 | Scor/rezultat | 0 puncte |
canonic.cpp: In function ‘int main()’: canonic.cpp:10:11: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | fscanf(fin,"%d%d",&cer,&n); | ~~~~~~^~~~~~~~~~~~~~~~~~~~ canonic.cpp:12:15: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | fscanf(fin,"%d",&x[i]); | ~~~~~~^~~~~~~~~~~~~~~~ canonic.cpp:23:18: warning: ‘s’ may be used uninitialized [-Wmaybe-uninitialized] 23 | s++; | ~^~ canonic.cpp:9:23: note: ‘s’ was declared here 9 | int cer,n,i,j,max,s,min; | ^ canonic.cpp:21:17: warning: ‘min’ may be used uninitialized [-Wmaybe-uninitialized] 21 | if(__gcd(x[j],x[j-1])<min) | ^~ canonic.cpp:9:25: note: ‘min’ was declared here 9 | int cer,n,i,j,max,s,min; | ^~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 2 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 4 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 5 | 0.01 secunde | Raspuns gresit. | 3 | 0 | ||
| 6 | 0.018 secunde | Raspuns gresit. | 3 | 0 | ||
| 7 | 0.018 secunde | Raspuns gresit. | 3 | 0 | ||
| 8 | 0.01 secunde | Raspuns gresit. | 3 | 0 | ||
| 9 | 0.119 secunde | Raspuns gresit. | 3 | 0 | ||
| 10 | 0.071 secunde | Raspuns gresit. | 3 | 0 | ||
| 11 | 0.128 secunde | Raspuns gresit. | 3 | 0 | ||
| 12 | 0.12 secunde | Raspuns gresit. | 3 | 0 | ||
| 13 | 0.182 secunde | Raspuns gresit. | 3 | 0 | ||
| 14 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 15 | 0.029 secunde | Raspuns gresit. | 3 | 0 | ||
| 16 | 0.001 secunde | Raspuns gresit. | 3 | 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.007 secunde | Raspuns gresit. | 3 | 0 | ||
| 21 | 0.007 secunde | Raspuns gresit. | 3 | 0 | ||
| 22 | 0.007 secunde | Raspuns gresit. | 3 | 0 | ||
| 23 | 0.007 secunde | Raspuns gresit. | 3 | 0 | ||
| 24 | 0.057 secunde | Raspuns gresit. | 3 | 0 | ||
| 25 | 0.059 secunde | Raspuns gresit. | 3 | 0 | ||
| 26 | 0.068 secunde | Raspuns gresit. | 3 | 0 | ||
| 27 | 0.057 secunde | Raspuns gresit. | 3 | 0 | ||
| 28 | 0.068 secunde | Raspuns gresit. | 3 | 0 | ||
| 29 | 0.201 secunde | Raspuns gresit. | 2 | 0 | ||
| 30 | 0.057 secunde | Raspuns gresit. | 2 | 0 | ||
| 31 | 0.29 secunde | Raspuns gresit. | 2 | 0 | ||
| 32 | 0.047 secunde | Raspuns gresit. | 2 | 0 | ||
| 33 | 0.032 secunde | Raspuns gresit. | 2 | 0 | ||
| 34 | 0.007 secunde | Raspuns gresit. | 2 | 0 | ||
| 35 | 0.022 secunde | Raspuns gresit. | 2 | 0 | ||
| 36 | 0.007 secunde | Raspuns gresit. | 2 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Canonic 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ă.