#4687
Feast
Se dă un șir de \(N\) numere întregi. Să se aleagă maxim \(K\) secvențe disjuncte astfel încât suma elementelor incluse în secvențe să fie maximă.
NOISG 2019, problema 3
Problema | Feast | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 256 MB
/
Stivă 256 MB
|
Id soluție | #51954883 | Utilizator | |
Fișier | feast.cpp | Dimensiune | 6.18 KB |
Data încărcării | 12 Septembrie 2024, 10:43 | Scor / rezultat | 100 puncte |
feast.cpp: In function 'void build(int, int, int)': feast.cpp:116:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses] int mj = st+dr >> 1; ^ feast.cpp: In function 'alexaint que(int, int)': feast.cpp:138:88: warning: suggest parentheses around '-' inside '<<' [-Wparentheses] ansst = combinemi(ansst, aintmi[qst], QST, (qst+1-(1<<__lg(qst)))*(1<<ainth-__lg(qst))), ^ feast.cpp:141:85: warning: suggest parentheses around '-' inside '<<' [-Wparentheses] ansdr = combinemi(aintmi[qdr], ansdr, 1 + (qdr-(1<<__lg(qdr)))*(1<<ainth-__lg(qdr)), QDR), ^ feast.cpp:151:88: warning: suggest parentheses around '-' inside '<<' [-Wparentheses] ansst = combinema(ansst, aintma[qst], QST, (qst+1-(1<<__lg(qst)))*(1<<ainth-__lg(qst))), ^ feast.cpp:154:85: warning: suggest parentheses around '-' inside '<<' [-Wparentheses] ansdr = combinema(aintma[qdr], ansdr, 1 + (qdr-(1<<__lg(qdr)))*(1<<ainth-__lg(qdr)), QDR), ^ feast.cpp: In member function 'char InParser::read_ch()': feast.cpp:38:29: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result] fread(buff, 1, 4096, fin); ^ feast.cpp: In function 'int main()': feast.cpp:235:44: warning: 'Yp' may be used uninitialized in this function [-Wmaybe-uninitialized] minmx = false; q = que(Yp+1, yp); ^ feast.cpp:230:44: warning: 'Xp' may be used uninitialized in this function [-Wmaybe-uninitialized] minmx = false; q = que(xp, Xp-1); ^ feast.cpp:235:45: warning: 'yp' may be used uninitialized in this function [-Wmaybe-uninitialized] minmx = false; q = que(Yp+1, yp); ^ feast.cpp:230:45: warning: 'xp' may be used uninitialized in this function [-Wmaybe-uninitialized] minmx = false; q = que(xp, Xp-1); ^ feast.cpp:222:64: warning: 'Ys' may be used uninitialized in this function [-Wmaybe-uninitialized] if (sum(q.x, q.y) >= 1) ivno.push({Xs, Ys, q.x, q.y}); ^ feast.cpp:222:64: warning: 'Xs' may be used uninitialized in this function [-Wmaybe-uninitialized] feast.cpp:219:71: warning: 'ys' may be used uninitialized in this function [-Wmaybe-uninitialized] if (sum(q.x, q.y) <= -1) ivuse.push({Ys+1, ys, q.x, q.y}); ^ feast.cpp:214:71: warning: 'xs' may be used uninitialized in this function [-Wmaybe-uninitialized] if (sum(q.x, q.y) <= -1) ivuse.push({xs, Xs-1, q.x, q.y}); ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0.036 secunde | OK. | 0 | 0 | ||
2 | 0.04 secunde | OK. | 0 | 0 | ||
3 | 0.04 secunde | OK. | 0 | 0 | ||
4 | 0.04 secunde | OK. | 0 | 0 | ||
5 | 0.04 secunde | OK. | 0 | 0 | ||
6 | 0.04 secunde | OK. | 0 | 0 | ||
7 | 0.04 secunde | OK. | 1 | 1 | ||
8 | 0.04 secunde | OK. | 1 | 1 | ||
9 | 0.04 secunde | OK. | 1 | 1 | ||
10 | 0.04 secunde | OK. | 1 | 1 | ||
11 | 0.036 secunde | OK. | 0 | 0 | ||
12 | 0.036 secunde | OK. | 0 | 0 | ||
13 | 0.036 secunde | OK. | 1 | 1 | ||
14 | 0.04 secunde | OK. | 1 | 1 | ||
15 | 0.036 secunde | OK. | 1 | 1 | ||
16 | 0.036 secunde | OK. | 1 | 1 | ||
17 | 0.04 secunde | OK. | 1 | 1 | ||
18 | 0.04 secunde | OK. | 1 | 1 | ||
19 | 0.036 secunde | OK. | 1 | 1 | ||
20 | 0.036 secunde | OK. | 1 | 1 | ||
21 | 0.044 secunde | OK. | 1 | 1 | ||
22 | 0.044 secunde | OK. | 1 | 1 | ||
23 | 0.044 secunde | OK. | 2 | 2 | ||
24 | 0.044 secunde | OK. | 2 | 2 | ||
25 | 0.044 secunde | OK. | 2 | 2 | ||
26 | 0.044 secunde | OK. | 2 | 2 | ||
27 | 0.044 secunde | OK. | 2 | 2 | ||
28 | 0.044 secunde | OK. | 2 | 2 | ||
29 | 0.044 secunde | OK. | 2 | 2 | ||
30 | 0.044 secunde | OK. | 2 | 2 | ||
31 | 0.032 secunde | OK. | 1 | 1 | ||
32 | 0.032 secunde | OK. | 1 | 1 | ||
33 | 0.032 secunde | OK. | 1 | 1 | ||
34 | 0.032 secunde | OK. | 1 | 1 | ||
35 | 0.032 secunde | OK. | 1 | 1 | ||
36 | 0.032 secunde | OK. | 1 | 1 | ||
37 | 0.032 secunde | OK. | 1 | 1 | ||
38 | 0.032 secunde | OK. | 1 | 1 | ||
39 | 0.032 secunde | OK. | 1 | 1 | ||
40 | 0.032 secunde | OK. | 1 | 1 | ||
41 | 0.032 secunde | OK. | 1 | 1 | ||
42 | 0.032 secunde | OK. | 1 | 1 | ||
43 | 0.032 secunde | OK. | 1 | 1 | ||
44 | 0.032 secunde | OK. | 1 | 1 | ||
45 | 0.032 secunde | OK. | 1 | 1 | ||
46 | 0.032 secunde | OK. | 1 | 1 | ||
47 | 0.032 secunde | OK. | 1 | 1 | ||
48 | 0.032 secunde | OK. | 1 | 1 | ||
49 | 0.032 secunde | OK. | 1 | 1 | ||
50 | 0.032 secunde | OK. | 2 | 2 | ||
51 | 0.032 secunde | OK. | 2 | 2 | ||
52 | 0.032 secunde | OK. | 2 | 2 | ||
53 | 0.032 secunde | OK. | 2 | 2 | ||
54 | 0.032 secunde | OK. | 2 | 2 | ||
55 | 0.032 secunde | OK. | 2 | 2 | ||
56 | 0.032 secunde | OK. | 2 | 2 | ||
57 | 0.032 secunde | OK. | 2 | 2 | ||
58 | 0.032 secunde | OK. | 2 | 2 | ||
59 | 0.032 secunde | OK. | 2 | 2 | ||
60 | 0.032 secunde | OK. | 2 | 2 | ||
61 | 0.092 secunde | OK. | 2 | 2 | ||
62 | 0.056 secunde | OK. | 3 | 3 | ||
63 | 0.088 secunde | OK. | 3 | 3 | ||
64 | 0.076 secunde | OK. | 3 | 3 | ||
65 | 0.076 secunde | OK. | 3 | 3 | ||
66 | 0.076 secunde | OK. | 3 | 3 | ||
67 | 0.044 secunde | OK. | 3 | 3 | ||
68 | 0.044 secunde | OK. | 3 | 3 | ||
69 | 0.044 secunde | OK. | 3 | 3 | ||
70 | 0.1 secunde | OK. | 3 | 3 | ||
71 | 0.028 secunde | OK. | 0 | 0 | Exemplu | |
72 | 0.028 secunde | OK. | 0 | 0 | Exemplu | |
73 | 0.028 secunde | OK. | 0 | 0 | Exemplu | |
Punctaj total | 100 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Feast 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ă.