#3723
Bob1
Dezamăgiți de lipsa fotbalului din ultima perioadă, Ștefan și Georgian și-au deschis (în secret) o afacere cu boabe de cafea, comercializând K
tipuri diferite de cafea. Astfel, timp de N
zile ei produc cafea, urmând să formeze din boabele obținute în zile consecutive pachete ce conțin toate tipurile de cafea. Concret, cei doi știu pentru fiecare zi ce tipuri de cafea produc în acea zi (posibil niciun tip, caz în care afacerea ia o pauză), după care ei împart zilele în secvențe continue astfel încât, pentru fiecare tip de cafea, fiecare secvență de zile să conțină cel puțin o zi în care să fie produs acel tip de cafea.
Înainte de a se apuca de împachetat boabele, Ștefan și Georgian își pun două întrebări:
1. Care este numărul maxim de pachete ce pot fi formate?
2. Care este numărul de moduri de a împărți zilele astfel încât să se formeze număr maxim de pachete valide (ce conțin toate tipurile de cafea)?
OJI 2021, clasele XI-XII
Problema | Bob1 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 3.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #43744409 | Utilizator | |
Fișier | bob1.cpp | Dimensiune | 2.63 KB |
Data încărcării | 13 Mai 2023, 16:08 | Scor / rezultat | Eroare de compilare |
bob1.cpp:12:12: error: array bound is not an integer constant before ']' token char a[NMAX][KMAX]; ^ bob1.cpp:12:18: error: array bound is not an integer constant before ']' token char a[NMAX][KMAX]; ^ bob1.cpp:13:11: error: array bound is not an integer constant before ']' token int e[NMAX]; /// e[i] - cel mai mic j astfel incat de la i la j am toate tipurile de cafea (i...j contine toate tip de cafea) ^ bob1.cpp:14:14: error: array bound is not an integer constant before ']' token int freq[KMAX]; /// freq[i] - de cate ori imi apare tipul i de cafea ^ bob1.cpp:15:11: error: array bound is not an integer constant before ']' token int m[NMAX]; /// m[i] - numarul maxim de pachete care se pot obtine din zilele de la i la N ^ bob1.cpp:16:11: error: array bound is not an integer constant before ']' token int d[NMAX]; /// d[i] - numarul de modalitati de a imparti zilele de la i la N astfel incat sa obtin un numar maxim de pachete ^ bob1.cpp:17:13: error: array bound is not an integer constant before ']' token int sum[NMAX]; /// sumele pe sufix pentru vectorul d ^ bob1.cpp: In function 'void test_case(int)': bob1.cpp:23:5: error: 'm' was not declared in this scope m[i] = sum[i] = 0; ^ bob1.cpp:23:12: error: 'sum' was not declared in this scope m[i] = sum[i] = 0; ^ bob1.cpp:26:5: error: 'freq' was not declared in this scope freq[i] = a[n+1][i] = 0; ^ bob1.cpp:26:15: error: 'a' was not declared in this scope freq[i] = a[n+1][i] = 0; ^ bob1.cpp:29:12: error: 'a' was not declared in this scope fin >> a[i]; ^ bob1.cpp:31:3: error: 'e' was not declared in this scope e[n+1] = n+1; ^ bob1.cpp:32:3: error: 'd' was not declared in this scope d[n+1] = sum[n+1] = 1; ^ bob1.cpp:32:12: error: 'sum' was not declared in this scope d[n+1] = sum[n+1] = 1; ^ bob1.cpp:36:11: error: 'a' was not declared in this scope if (a[i][j] == '1') ^ bob1.cpp:37:9: error: 'freq' was not declared in this scope freq[j]++; ^ bob1.cpp:38:11: error: 'freq' was not declared in this scope if (freq[k] == 0) ^ bob1.cpp:48:11: error: 'freq' was not declared in this scope freq[j] -= (a[e[i]][j] == '1'); ^ bob1.cpp:48:23: error: 'a' was not declared in this scope freq[j] -= (a[e[i]][j] == '1'); ^ bob1.cpp:53:7: error: 'm' was not declared in this scope m[i] = m[e[i] + 1] + 1; ^ bob1.cpp:62:18: error: 'dr' was not declared in this scope while (st <= dr) { ^ bob1.cpp:64:11: error: 'm' was not declared in this scope if (m[mid] <= val) { ^ bob1.cpp:64:21: error: 'val' was not declared in this scope if (m[mid] <= val) { ^ bob1.cpp:65:12: error: assignment of function 'double j1(double)' j1 = mid; ^ bob1.cpp:65:12: error: cannot convert 'int' to 'double(double)throw ()' in assignment bob1.cpp:69:20: error: 'dr' was not declared in this scope st = e[i] + 1, dr = N + 1; ^ bob1.cpp:69:25: error: 'N' was not declared in this scope st = e[i] + 1, dr = N + 1; ^ bob1.cpp:73:11: error: 'm' was not declared in this scope if (m[mid] >= val) { ^ bob1.cpp:73:21: error: 'val' was not declared in this scope if (m[mid] >= val) { ^ bob1.cpp:84:13: error: 'm' was not declared in this scope fout << m[1] << '\n'; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Bob1 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ă.