Все задачи на 5.10.17 13:00

This commit is contained in:
2017-10-05 13:08:02 +03:00
parent 93746b05d7
commit ca2ca71f63
120 changed files with 2343 additions and 0 deletions

33
uts/uts_17_aut_py/3/B.py Normal file
View File

@@ -0,0 +1,33 @@
n, NAVALNIY = list(map(int, input().split()))
VSTRECHAS = []
for i in range(n):
VSTRECHAS.append(list(map(int, input().split())))
n = 1
for vst in VSTRECHAS:
vst.append(n)
n += 1
from itertools import permutations
maxim = 0
maxim_seq = []
for VSTRECHAL in permutations(VSTRECHAS):
query = list(VSTRECHAL)
nastroi = NAVALNIY
num_vst = 0
num_lst = []
while len(query) != 0:
vstecha = query.pop()
if vstecha[0] <= nastroi <= vstecha[1]:
nastroi += vstecha[2]
num_vst += 1
num_lst.append(vstecha[3])
else:
break
if num_vst > maxim:
maxim = num_vst
maxim_seq = num_lst
if maxim == n:
break
ans = []
print(maxim)
for i in maxim_seq:
print(i, end=' ')