#3600
Se dă un șir a
de n
numere naturale nenule strict mai mari decât 1
, indexat de la 1
. Asupra acestui șir se aplică 3
tipuri de operații:
1 st dr val
– toate valorile a[i]
cu i
din intervalul [st, dr]
devin egale cu val
;2 st dr
– se cere să se afle câte elemente ale șirului a
care au indicii aflați în intervalul [st, dr]
sunt numere compuse(un număr natural este compus dacă are cel puțin 3
divizori);3 st dr
– se cere să se afișeze lungimea cele mai lungi secvențe de numere prime alcătuită exclusiv din elemente ale șirului care au indicii aflați în intervalul [st, dr]
(o secvență a unui șir este alcătuită din elemente aflate poziții consecutive).Dându-se Q
operații, să se raspundă în ordine la cele de tip 2
și 3
.
Problema | numbers_tree | Operații I/O |
![]() numbers_tree.in /numbers_tree.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 8 MB
/
Stivă 4 MB
|
Id soluție | #50736037 | Utilizator | |
Fișier | numbers_tree.cpp | Dimensiune | 4.10 KB |
Data încărcării | 26 Aprilie 2024, 16:56 | Scor / rezultat | Eroare de compilare |
numbers_tree.cpp:6:1: error: 'bitset' does not name a type bitset < NMAX > sieve; ^ numbers_tree.cpp: In function 'void Eratostene()': numbers_tree.cpp:10:9: error: 'sieve' was not declared in this scope sieve[i] = true; ^ numbers_tree.cpp:12:13: error: 'sieve' was not declared in this scope if(!sieve[i]) ^ numbers_tree.cpp: At global scope: numbers_tree.cpp:21:5: error: 'vector' does not name a type vector < node > Tree; ^ numbers_tree.cpp: In member function 'void SegTree::init(int)': numbers_tree.cpp:27:9: error: 'Tree' was not declared in this scope Tree.resize((Size << 1) | 1); ^ numbers_tree.cpp: In member function 'void SegTree::propagate(int, int, int)': numbers_tree.cpp:43:24: error: 'Tree' was not declared in this scope if(lx == rx || Tree[x].lazy == -1) ^ numbers_tree.cpp:48:13: error: 'Tree' was not declared in this scope Tree[(x << 1) | i].sum = Tree[(x << 1) | i].pref = Tree[(x << 1) | i].suf = Tree[(x << 1) | i].mx = len[i] * Tree[x].lazy; ^ numbers_tree.cpp:51:9: error: 'Tree' was not declared in this scope Tree[x].lazy = -1; ^ numbers_tree.cpp: In member function 'void SegTree::build(int, int, int)': numbers_tree.cpp:57:19: error: 'sieve' was not declared in this scope val = sieve[val] ^ 1; ^ numbers_tree.cpp:58:13: error: 'Tree' was not declared in this scope Tree[x] = node{val, val, val, val, val}; ^ numbers_tree.cpp:65:9: error: 'Tree' was not declared in this scope Tree[x] = Merge(Tree[x << 1], Tree[(x << 1) | 1], mid - lx + 1, rx - mid); ^ numbers_tree.cpp: In member function 'void SegTree::update(int, int, int, int, int, int)': numbers_tree.cpp:70:13: error: 'Tree' was not declared in this scope Tree[x].sum = Tree[x].pref = Tree[x].suf = Tree[x].mx = (rx - lx + 1) * val; ^ numbers_tree.cpp:79:9: error: 'Tree' was not declared in this scope Tree[x] = Merge(Tree[x << 1], Tree[(x << 1) | 1], mid - lx + 1, rx - mid); ^ numbers_tree.cpp: In member function 'int SegTree::query_sum(int, int, int, int, int)': numbers_tree.cpp:84:37: error: 'Tree' was not declared in this scope return ((rx - lx + 1) - Tree[x].sum); ^ numbers_tree.cpp: In member function 'node SegTree::query_sequence(int, int, int, int, int)': numbers_tree.cpp:95:20: error: 'Tree' was not declared in this scope return Tree[x]; ^ numbers_tree.cpp: In function 'int main()': numbers_tree.cpp:119:19: error: 'sieve' was not declared in this scope val = sieve[val] ^ 1; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema numbers_tree 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ă.