7 359
订阅者
-324 小时
-237 天
-11330 天
帖子存档
def solve(N, K, Count, A, Q, XY):
results = []
for x, y in XY:
p = A[x - 1]
c = 0
for i in range(N):
if A[i] > p:
c += Count[i]
e = (c // K) + 1
z = c + 1
if e <= y <= z + Count[x - 1] - 1:
results.append("YES")
else:
results.append("NO")
return results
Favourite Candy✅
def solve(N, M, grid, K):
def is_star(r, c, grid):
val = grid[r][c]
if val == 0:
return False
for dr, dc in [(-1,0), (1,0), (0,-1), (0,1)]:
nr, nc = r + dr, c + dc
if not (0 <= nr < N and 0 <= nc < M):
return False
if grid[nr][nc] != val:
return False
return True
def check_win(grid):
for r in range(1, N-1):
for c in range(1, M-1):
if is_star(r, c, grid):
return True
return False
def serialize(grid):
return tuple(tuple(row) for row in grid)
def dfs(state, turn):
grid = [list(row) for row in state]
if check_win(grid):
return (0, 1, 0) if turn == 1 else (0, 0, 1)
moves = [(r, c) for r in range(N) for c in range(M) if grid[r][c] == 0]
if not moves:
return (1, 0, 0)
total = [0, 0, 0]
for r, c in moves:
for fruit in range(1, K+1):
grid[r][c] = fruit
res = dfs(serialize(grid), 1 - turn)
for i in range(3):
total[i] += res[i]
grid[r][c] = 0 # backtrack
return tuple(total)
result = dfs(serialize(grid), 0)
print(*result)
The game of grid✅✅
def solve(N,Q,commands):
slots=[0]*N
for i in commands:
slots[i-1]^=1
return sum(slots)
Memory slot Flip✅
def ABpair(N):
res=1
while True:
if N+res==2*(N^res):
return res
res+=1
Arithmetic bitwise pairs✅
//GalaxE solutions✅
Company: Capgemini
Role: SAP SD
Experience Required: Minimum 6 months to 3 Years of genuine experience in any domain (non-IT experience is also acceptable)
Package: ₹5.5L + 25k bonus (5.75LPA)
Location: PAN India
Process Duration: Approximately 1 month
Notice Period: Immediate joiners only (Upto 30 days notice period accepted)
Eligibility: Open to both male and female candidates
Year of passing: 2021-2024
Process -
1.Registration.
2.Online Exam
3.Technical Interview
4.LOI
5.Offer letter
All Rounds will be Virtual
Note : candidate should have 6 months genuine work experience(IT or NON-IT) including payslips and bank statement.
Interested people can reach out
@MLCODER2
Capgemini offer letter for SAP role ✅
Contact : @MLCODER2
import heapq
from collections import defaultdict
def solve(n, m, k, treasures, bridges, queries):
graph = defaultdict(list)
for u, v, w in bridges:
graph[u - 1].append((v - 1, w))
results = []
for start, end in queries:
start -= 1
end -= 1
pq = [(-treasures[start], 0, start)]
visited = {}
while pq:
neg_tres, time, node = heapq.heappop(pq)
total_treasure = -neg_tres
if node == end:
results.append((total_treasure, time))
break
if node in visited and visited[node] >= total_treasure:
continue
visited[node] = total_treasure
for nei, wt in graph[node]:
if nei not in visited or visited[nei] < total_treasure + treasures[nei]:
heapq.heappush(pq, (-(total_treasure + treasures[nei]), time + wt, nei))
return results
n, m, k = map(int, input().split())
treasures = list(map(int, input().split()))
bridges = [tuple(map(int, input().split())) for _ in range(m)]
queries = [tuple(map(int, input().split())) for _ in range(k)]
result = solve(n, m, k, treasures, bridges, queries)
for treasure, time in result:
print(treasure, time)
q3
//quantiphi ✅
def max_points(points):
n = len(points)
if n == 0:
return 0
if n == 1:
return points[0]
dp = [0] * n
dp[0] = points[0]
dp[1] = max(points[0], points[1])
for i in range(2, n):
dp[i] = max(dp[i-1], points[i] + dp[i-2])
return dp[-1]
n = int(input())
points = list(map(int, input().split()))
print(max_points(points))
q2
//quantiphi ✅
import math
def is_possible(K, houses, H):
total_time = 0
for house in houses:
total_time += math.ceil(house / K)
return total_time <= H
def find_min_K(n, H, houses):
low = 1
high = max(houses)
answer = high
while low <= high:
mid = (low + high) // 2
if is_possible(mid, houses, H):
answer = mid
high = mid - 1
else:
low = mid + 1
return answer
n, H = map(int, input().split())
houses = list(map(int, input().split()))
print(find_min_K(n, H, houses))
q1
//quantiphi✅
company : Capgemini
Role : Associate software Engineer
Batches : 2023/3034/3035/
Location : Bangalore/Chennai
Link to apply : https://careers.capgemini.com/job/Bangalore-Associate-Software-Engineer/1225820501/
+3
Paypal exam done & dusted ✅✅
Python 4+ years experienced ✅
