Участник:Srip09/DIGITAL

Материал из DISCOPAL
Перейти к: навигация, поиск

https://www.codechef.com/problems/TRINDIA2

n = int(input())
k = int(input())
 
 
 
 
A = []
#l = input().split()
#for i in range(0, n):
#    A.append(int(l[i]))
#B = []
#for i in range(0, n):
#    B.append(int(l[i + n]))
for i in range(0, n):
    A.append(int(input()))
B = []
for i in range(0, n):
    B.append(int(input()))
if (n != k):
    C = [0] * n
else:
    C = [1] * n    
 
sum1 = 0.
sum2 = 0.
index = 0
if (k < n):
    for i in range(0, k):
        check = 0.
        for j in range(0, n):
            if ( (C[j] == 0) and (sum1 + A[j]) / (sum2 + B[j] * A[j]) > check):
                index = j
                check = (sum1 + A[j])/(sum2 + A[j] * B[j])
        C[index] = 1
        sum1 += A[index]
        sum2 += A[index] * B[index]
 
for i in range(0, n):
    if (C[i] == 1):
        print(i, end = ' ')
 


StasFomin 09:27, 20 мая 2021 (MSK): NZEC DIGITAL 2021-05-20 09-27-31 image0.png