Y
допустим тут дало
—Ronaldinho in 2007 with both players named in the FIFA World XI.[5] —Zinedine Zidane on Gerrard, 2009.[66]
Size: a a a
Y
—Ronaldinho in 2007 with both players named in the FIFA World XI.[5] —Zinedine Zidane on Gerrard, 2009.[66]
T
—Ronaldinho in 2007 with both players named in the FIFA World XI.[5] —Zinedine Zidane on Gerrard, 2009.[66]
<p class="mw-empty-elt">
но это первый абзац, твоим условиям удовлетворяетЗ🧟
В
З🧟
В
Y
Y
Y
Y
Y
Y
L
L
L
class Vector {
constructor(len, bits = 0) {
this.bits = bits
this.array = new Uint8Array(len)
}
init(len) {
this.array.fill(0, 0, len)
}
add(start, end) {
for(let i = start; i < end; i++)
this.array[i] ^= 1
}
get(i) {
return this.array[i]
}
}
const SEGMENT_BITS_6 = 4
const SEGMENT_BITS_10 = 7
const SEGMENT_BITS_15 = 12
const vec = new Vector(100e3)
const vecSeg6 = new Vector((100e3 >> SEGMENT_BITS_6) + 1)
const vecSeg10 = new Vector((100e3 >> SEGMENT_BITS_10) + 1)
const vecSeg15 = new Vector((100e3 >> SEGMENT_BITS_15) + 1)
const genAdd = (addThis, addNext, SEGMENT_BITS) =>
(start, end) => {
const startSeg = (start >> SEGMENT_BITS) + 1
const endSeg = end >> SEGMENT_BITS
if ( startSeg <= endSeg ) {
addThis(startSeg, endSeg)
addNext(start, startSeg << SEGMENT_BITS)
addNext(endSeg << SEGMENT_BITS, end)
return
}
addNext(start, end)
}
const add = genAdd(
(s, e) => vecSeg15.add(s, e),
genAdd(
(s, e) => vecSeg10.add(s, e),
genAdd(
(s, e) => vecSeg6.add(s, e),
(s, e) => vec.add(s, e),
SEGMENT_BITS_6
),
SEGMENT_BITS_10
),
SEGMENT_BITS_15
)
const get = i => vecSeg15.get(i >> SEGMENT_BITS_15) ^ vecSeg10.get(i >> SEGMENT_BITS_10) ^ vecSeg6.get(i >> SEGMENT_BITS_6) ^ vec.get(i)
function binarySimulation(s, q) {
vec.init(s.length)
vecSeg6.init((s.length >> SEGMENT_BITS_6) + 1)
vecSeg10.init((s.length >> SEGMENT_BITS_10) + 1)
vecSeg15.init((s.length >> SEGMENT_BITS_15) + 1)
const r = []
for(const v of q) {
switch(v[0]) {
case "I":
add(v[1] - 1, v[2])
break
case "Q":
const i = v[1] - 1
r.push( '' + ( get(i) ^ s[i] ) )
break
}
}
return r
}
L
L