-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path123.py
More file actions
31 lines (27 loc) · 748 Bytes
/
123.py
File metadata and controls
31 lines (27 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pc, n, h = map(int,input().split())
pclist = [[] for _ in range(pc + 1)]
for _ in range(n):
i , value = map(int,input().split())
pclist[i].append(value)
for i in range(1,pc+1):
pclist[i].sort()
resultlist = [0 for _ in range(h+ 1)]
print(pclist)
for i in range(1, pc+1):
price = 0
for hour in pclist[i]:
if hour > h:
break
resultlist[hour] = hour
for hour in pclist[i]:
if hour > h:
break
for hour1 in pclist[i][pclist[i].index(hour)+1:]:
if hour + hour1 > h:
break
resultlist[hour + hour1] = (hour + hour1) * 1000
res = 0
for result in resultlist:
if result > res:
res = result
print(i,res)