Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/web-klick.de/dsh/50_dev2017/1310__algorithms/Julia/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/web-klick.de/dsh/50_dev2017/1310__algorithms/Julia/TopCoder.jl

module TopCoder

#using Debug

export Find

type StreetMap
    m::Integer
    es::Real
    vs::Real
    col::Array{Bool, 1}
    g::Array{Bool, 2}
    
    StreetMap(e::Real, v::Real, co::Array{Bool, 1}, g::Array{Bool, 2}, m_=1234567891) = new(m_, e, v, co, g)
end

function dfs!(o::StreetMap, i::Int)
    (o.col[i] == true) && return
    o.vs += 1
    o.col[i] = true
    for j = 1:2
        if(o.g[i,j])
            o.es += 1
            dfs!(o, j)
        end
    end
end

function bitcount(a::Uint)
    sum::Int = 0
    for i in 1:(sizeof(a) * 8) - leading_zeros(a)
        sum += (a>>i) & 0x1
    end
    return sum
end
bitcount(a::Integer) = bitcount(unsigned(abs(a)))

function bitcount2(a::Uint)
    sum::Int = 0
    while a != 0
        a &= a - 1
        sum += 1
    end
    return sum
end

function lzeros(a::Uint)
    n::Int = 0
    (a == 0) && return sizeof(a) * 8
    while true
        (a == typemax(Uint)) && break
        n += 1
        a <<=1
    end
    return n
end
lzeros(a::Integer) = lzeros(unsigned(abs(a)))

function Find(o::StreetMap, map_)
    n = int(length(map_)/2)
    for i = 1:n, j = 1:n
        #println(map_[i,j] == "Y")
        o.g[i, j] = map_[i,j]=="Y"
    end
    cyc = 0
    list = int(zeros(n))
    for i=1:n
        if(!o.col[i])
            o.vs = o.es = 0
            dfs!(o, i)
            push!(list, o.vs)
            o.es = o.es/2
            if(o.vs == o.es)
                if(cyc != -1)
                    return
                end
                cyc = length(list)
            end
        end
    end
    n = int(length(list))
    a = copy(list)
    sum_, mul_ = int(zeros(1 << n)), int(zeros(1 << n))
    mul_[1] = 1
    for i = 1:(1 << n)-1
        t = 1
        while (i & (1 << (t-1))) == 0
            t += 1
        end
        #@bp
        #println(i, ":", 1 << t-1, ":", (i $ (1 << t-1))+1)
        sum_[i] = Base.mod((sum_[(i $ (1 << (t-1))+1)] + a[t]), o.m)
        mul_[i] = Base.mod((sum_[(i $ (1 << (t-1))+1)] * a[t]), o.m)
    end
    if cyc == -1
        mask = 1 << cyc
        #println(cyc, ":", mask, ":", ((1 << n) - 1) $ mask, ":", length(sum_), ":", length(mul_))
        return solve(a, mask, sum_[mask], sum_[((1 << n) - 1) $ mask], mul_[((1 << n) - 1) $ mask]);
    end
    #(sum_', mul_')
    ans = 0
    fact = zeros(99)
    tt = 1
    fact[4] = 1
    for i = 4:99
        tt = mod((tt * i), o.m)
        fact[i+1] = tt
    end
    for m = 1:mask < (1<<n)
        cycles = 0
        m = bitcount(mask)
        if m == 0
            cycles = 1
        elseif m == 1
            i = trailing_zeros(mask)
            cycles = (a[i] - 2) * (a[i] - 1) / 2
        elseif m == 2
            u, v = -1, -1
        end
    end
end

function solve(o::StreetMap, a::Array{Float64, 1}, mask::Integer, sum0::Integer, sum1::Integer, mul0::Integer)
    n = length(a)
    cycle = sum0
    ans = cycle
    sum = mod((sum + cycle), o.m)
    println("Sum: ", sum)
end

end

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net