๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.62K subscribers
5.61K photos
3 videos
95 files
10.6K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
void solve() {
ll n,k;cin>>n>>k;
v ans(n,0),temp;
v a(n+1,1);
ll maxi=n+1,mini=0;
fr(0,n-k,i){
    if(ans[i])continue;
    if(i&1){
      ans[i]=--maxi,a[maxi]=0;
      ans[i+k]=--maxi,a[maxi]=0;
    }
    else {
      ans[i]=++mini,a[mini]=0;
      ans[i+k]=++mini,a[mini]=0;
    }
}
fr(1,n+1,i)if(a[i])temp.push_back(i);
ll sz=temp.size(),j=0;
fr(0,n,i){
    if(!ans[i])ans[i]=temp[j++];
}
fr(0,n,i)dbg(ans[i]);


}

Rotate or Reverse โœ…
๐Ÿ‘1
Hi Guys,

Use this ChatGPT prompt and apply in the suggested openings specifically, Could be a game changer.

Context: You are a job-seeker looking for a [ROLE] in the [INDUSTRY]. You are focusing on roles where you meet at least 80% of the listed qualifications in India.

Task: Based on the attached resume (PDF), provide a list of job roles and companies that align with my qualifications. For each recommendation, include the estimated percentage chance of securing an interview based on how closely my experience matches the job requirements.
import sys
from collections import deque
mod = 998244353
def main():
    n, k = map(int, sys.stdin.readline().split())
    g = [[] for _ in range(n + 1)]
   
    for _ in range(n - 1):
        u, v = map(int, sys.stdin.readline().split())
        g[u].append(v)
        g[v].append(u)
   
    ans = 0
   
    for c in range(1, n + 1):
        q = deque()
        q.append(c)
        d = [-1] * (n + 1)
        d[c] = 0
        parent = [-1] * (n + 1)
       
        while q:
            u = q.popleft()
            for v in g[u]:
                if d[v] == -1:
                    d[v] = d[u] + 1
                    parent[v] = u
                    q.append(v)
       
        children = {}
        for u in range(1, n + 1):
            if u == c or d[u] == -1:
                continue
            p = u
            while parent[p] != c and parent[p] != -1:
                p = parent[p]
            if parent[p] == c:
                children.setdefault(p, []).append(u)
       
        max_d = max(d)
       
        for l in range(1, max_d + 1):
            cnt = []
            for child, nodes in children.items():
                cnt_i = 0
                for u in nodes:
                    if d[u] == l:
                        cnt_i += 1
                if cnt_i > 0:
                    cnt.append(cnt_i)
            m = len(cnt)
            if m < k:
                continue
           
            dp = [0] * (k + 1)
            dp[0] = 1
           
            for c_i in cnt:
                for x in range(min(k, len(cnt)), 0, -1):
                    dp[x] = (dp[x] + dp[x - 1] * c_i) % mod
           
            ans = (ans + dp[k]) % mod
   
    print(ans)

if __name__ == "__main__":
    main()


Newtree
Rubrik โœ…
๐Ÿ‘1
import sys
MOD=998244353

def mult(a, b, K):
    res = [0] * K
    for i in range(K):
        ai = a[i]
        if ai:
            for j in range(K):
                res[(i + j) % K] = (res[(i + j) % K] + ai * b[j]) % MOD
    return res

def power(a, e, K):
    res = [0] * K
    res[0] = 1
    while e:
        if e & 1:
            res = mult(res, a, K)
        a = mult(a, a, K)
        e >>= 1
    return res

def main():
    input = sys.stdin.read
    data = list(map(int, input().split()))
   
    ptr = 0
    N = data[ptr]
    P = data[ptr + 1]
    K = data[ptr + 2]
    ptr += 3
   
    M = data[ptr]
    ptr += 1
   
    L = data[ptr:ptr + M]
    ptr += M
   
    C = [P // K + (1 if j > 0 and j <= P % K else 0) for j in range(K)]
    LC = [0] * K
   
    for x in L:
        LC[x % K] += 1
   
    Cn = [(C[j] - LC[j]) % MOD for j in range(K)]
   
    T = power(C, N, K)[0]
    B = power(Cn, N, K)[0]
   
    print((T - B) % MOD)

main()


Lucky Charm
Rubrik โœ