#3695
iziStack
Se dă o stivă vidă. Elementele stivei sunt numerotate incepand cu 1
de la bază înspre vârf. Avem de procesat T
comenzi de tipurile:
0 x
– elementul x
se va adăuga în vârful stivei1 x y add
– tuturor elementelor din intervalul x y
le va fi adăugată valoarea add
2
– eliminarea elementului din vârfAfisați dupa fiecare operație elementul din vârful stivei.
Concursul Național Info Pro, Etapa III
Problema | iziStack | Operații I/O |
![]() izi.in /izi.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #28850058 | Utilizator | |
Fișier | izistack.cpp | Dimensiune | 6.09 KB |
Data încărcării | 20 Martie 2021, 20:54 | Scor / rezultat | Eroare de compilare |
izistack.cpp: In function 'group_info* groups_alloc(int)': izistack.cpp:13:26: error: 'NGROUPS_PER_BLOCK' was not declared in this scope nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK; ^ izistack.cpp:19:41: error: invalid application of 'sizeof' to incomplete type 'group_info' group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER); ^ izistack.cpp:19:60: error: 'gid_t' was not declared in this scope group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER); ^ izistack.cpp:19:67: error: expected primary-expression before ')' token group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER); ^ izistack.cpp:19:70: error: 'GFP_USER' was not declared in this scope group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER); ^ izistack.cpp:19:78: error: 'kmalloc' was not declared in this scope group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER); ^ izistack.cpp:23:10: error: 'NULL' was not declared in this scope return NULL; ^ izistack.cpp:25:14: error: 'gt' was not declared in this scope group_info->ngroups = gidsetsize; ^ izistack.cpp:25:17: error: 'ngroups' was not declared in this scope group_info->ngroups = gidsetsize; ^ izistack.cpp:29:14: error: 'amp' was not declared in this scope atomic_set(&group_info->usage, 1); ^ izistack.cpp:29:33: error: 'usage' was not declared in this scope atomic_set(&group_info->usage, 1); ^ izistack.cpp:29:41: error: expected ';' before ')' token atomic_set(&group_info->usage, 1); ^ izistack.cpp:33:18: error: 'lt' was not declared in this scope if (gidsetsize <= NGROUPS_SMALL) ^ izistack.cpp:33:20: error: expected ')' before ';' token if (gidsetsize <= NGROUPS_SMALL) ^ izistack.cpp:33:21: error: expected primary-expression before '=' token if (gidsetsize <= NGROUPS_SMALL) ^ izistack.cpp:33:23: error: 'NGROUPS_SMALL' was not declared in this scope if (gidsetsize <= NGROUPS_SMALL) ^ izistack.cpp:33:36: error: expected ';' before ')' token if (gidsetsize <= NGROUPS_SMALL) ^ izistack.cpp:35:18: error: 'blocks' was not declared in this scope group_info->blocks[0] = group_info->small_block; ^ izistack.cpp:35:45: error: 'small_block' was not declared in this scope group_info->blocks[0] = group_info->small_block; ^ izistack.cpp:37:2: error: 'else' without a previous 'if' else { ^ izistack.cpp:39:18: error: 'lt' was not declared in this scope for (i = 0; i < nblocks; i++) { ^ izistack.cpp:39:22: warning: for increment expression has no effect [-Wunused-value] for (i = 0; i < nblocks; i++) { ^ izistack.cpp:39:29: error: expected ')' before ';' token for (i = 0; i < nblocks; i++) { ^ izistack.cpp:39:34: error: expected ';' before ')' token for (i = 0; i < nblocks; i++) { ^ izistack.cpp:61:16: error: expected ')' before ';' token while (--i >= 0) { ^ izistack.cpp:61:17: error: expected primary-expression before '=' token while (--i >= 0) { ^ izistack.cpp:61:20: error: expected ';' before ')' token while (--i >= 0) { ^ izistack.cpp:67:18: error: 'kfree' was not declared in this scope kfree(group_info); ^ izistack.cpp:69:9: error: 'NULL' was not declared in this scope return NULL; ^ izistack.cpp:59:1: warning: label 'out_undo_partial_alloc' defined but not used [-Wunused-label] out_undo_partial_alloc: ^ izistack.cpp: At global scope: izistack.cpp:75:14: error: expected constructor, destructor, or type conversion before '(' token EXPORT_SYMBOL(groups_alloc); ^ izistack.cpp: In function 'void groups_free(group_info*)': izistack.cpp:83:18: error: 'gt' was not declared in this scope if (group_info->blocks[0] != group_info->small_block) { ^ izistack.cpp:83:20: error: expected ')' before ';' token if (group_info->blocks[0] != group_info->small_block) { ^ izistack.cpp:83:21: error: 'blocks' was not declared in this scope if (group_info->blocks[0] != group_info->small_block) { ^ izistack.cpp:83:46: error: 'gt' was not declared in this scope if (group_info->blocks[0] != group_info->small_block) { ^ izistack.cpp:83:49: error: 'small_block' was not declared in this scope if (group_info->blocks[0] != group_info->small_block) { ^ izistack.cpp:83:60: error: expected ';' before ')' token if (group_info->blocks[0] != group_info->small_block) { ^ izistack.cpp:93:18: error: 'kfree' was not declared in this scope kfree(group_info); ^ izistack.cpp: At global scope: izistack.cpp:99:14: error: expected constructor, destructor, or type conversion before '(' token EXPORT_SYMBOL(groups_free); ^ izistack.cpp:105:27: error: 'gid_t' was not declared in this scope static int groups_to_user(gid_t __user *grouplist, ^ izistack.cpp:107:6: error: expected primary-expression before 'const' const struct group_info *group_info) ^ izistack.cpp:107:41: error: expression list treated as compound expression in initializer [-fpermissive] const struct group_info *group_info) ^ izistack.cpp:109:1: error: expected ',' or ';' before '{' token { ^ izistack.cpp:105:12: warning: 'groups_to_user' defined but not used [-Wunused-variable] static int groups_to_user(gid_t __user *grouplist, ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema iziStack 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ă.