Skip to content

Commit 5e0ce66

Browse files
committed
initial Commit
0 parents  commit 5e0ce66

File tree

692 files changed

+145071
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

692 files changed

+145071
-0
lines changed

.idea/Programming.iml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 690 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Allincall/colors.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def solve( A):
2+
color3 = 24
3+
color2 = 12
4+
temp = 0
5+
6+
for i in range(2, A + 1):
7+
8+
9+
color2 = (5 * temp + 7 * color2) % 1000000007
10+
11+
num = ( color2) % 1000000007
12+
13+
return num
14+
print(solve(2))

Allincall/group_employes.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Binomial Sum
2+
def select(n):
3+
return (1 << n)
4+
5+
n = int(input())
6+
a = list(map(int,input().split()))
7+
8+
#-- Counting Ids
9+
#emp = {}
10+
l=set(a)
11+
emp=[]
12+
for i in l:
13+
emp.append(a.count(i))
14+
15+
16+
# Selection
17+
result = 0
18+
for i in emp:
19+
result += (select(i) -(i+1))
20+
print(int(result)%1000000007)

Allincall/magic.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def canCompleteCircuit(gas, cost):
2+
if sum(gas) < sum(cost): return -1
3+
n, s, r = len(gas), 0, 0
4+
for i in range(n):
5+
if gas[i] + r < cost[i]:
6+
s, r = i+1, 0
7+
else:
8+
r += gas[i]-cost[i]
9+
return s

Allincall/maximize_revenue.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
n = int(input())
2+
dic = {}
3+
while (n):
4+
temp = list(map(int, input().split()))
5+
i = temp[1]
6+
while (i):
7+
dic[i] = dic.get(i, [])
8+
dic[i].append(temp[0])
9+
i -= 1
10+
n -= 1
11+
12+
temp = []
13+
maximum=max(dic.keys())
14+
15+
for i in range(maximum, 0, -1):
16+
flag = dic[i]
17+
for j in range(len(temp)):
18+
flag.remove(temp[j])
19+
if (len(flag) > 0):
20+
temp.append(max(flag))
21+
22+
print(sum(temp))

Allincall/merge_intent.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import heapq
2+
n = int(input())
3+
arr = list(map(int,input().split()))
4+
cost,res=0,0
5+
heapq.heapify(arr)
6+
for i in range(1,len(arr)):
7+
cost = heapq.heappop(arr) + heapq.heappop(arr) - 1
8+
heapq.heappush(arr, cost+1)
9+
res += cost
10+
print(res)

0 commit comments

Comments
 (0)