Problem:


Score: 200 points

Problem Statement

A country decides to build a palace.

In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.

There are N places proposed for the place. The elevation of Place i is H_i meters.

Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.

Print the index of the place where the palace should be built.

It is guaranteed that the solution is unique.

Constraints

1 \leq N \leq 1000

0 \leq T \leq 50

-60 \leq A \leq T

0 \leq H_i \leq 10^5

All values in input are integers.

The solution is unique.

Input

Input is given from Standard Input in the following format:

N
T A
H_1 H_2 ... H_N

Output

Print the index of the place where the palace should be built.

Sample Input 1

2
12 5
1000 2000

Sample Output 1

1

The average temperature of Place 1 is 12-1000 \times 0.006=6 degrees Celsius.

The average temperature of Place 2 is 12-2000 \times 0.006=0 degrees Celsius.

Thus, the palace should be built at Place 1.

Sample Input 2

3
21 -11
81234 94124 52141

Sample Output 2

3



Sample input:
2
12 5
1000 2000


Sample output:
1

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
l = list(map(int,input().split()))
#print(n,t,a,l)

x = []
for i in range(n):
    x.append( abs(a- (t - l[i] * 0.006)))
print(x.index(min(x))+1)

Submission status: Accepted

Solution code:
n = int(input())
x = input().split(" ")
t = int(x[0])
a = int(x[1])
h = list(map(int, input().split(" ")))

dif = []

for i in range(n):
    z = abs(t - h[i] * 0.006 - a)
    dif.append(z)

dif_s = sorted(dif)
# print(dif)
# print(dif_s)
# print(dif_s[n-1])
min = dif_s[0]
print(dif.index(min)+1)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    T, A = map(int, input().split(" "))
    H = list(map(int, input().split(" ")))
    target = (T - A) / 0.006
    difference = 10 ** 6
    answer = 60
    for i in range(N):
        if abs(H[i] - target) < difference:
            difference = abs(H[i] - target)
            answer = i
    print(answer + 1)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = [abs(T-(int(a)*0.006)-A) for a in input().split()]
print(H.index(min(H))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
min = 1000000
for i in range(n):
    temp = t - h[i]*0.006
    k = abs(a-temp)
    if min > k:
        min = k
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int,input().split())
l = list(map(int,input().split()))

lm = [abs(t - 0.006*h - a) for h in l]
print(lm.index(min(lm))+1)

Submission status: Accepted

Solution code:
import sys
import math
import itertools

n=int(input())
t,a=list(map(int,input().split()))
h=list(map(int,input().split()))
min = 100000
ans = 0
for i in range(n):
    temp = t - (h[i] * 0.006)
    if min > abs(a - temp):
        min = abs(a - temp)
        ans = i
print(ans + 1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
for i in range(n):
  temp = t - h[i]*0.006
  k = abs(a-temp)
  if i == 0:
    ans = i+1
    keep = k
  else:
    if keep>k:
      ans = i+1
      keep = k
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = []
for i in range(n):
     ans.append(abs(a-(t-h[i]*6/1000)))
print(ans.index(min(ans))+1)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
T, A = map(int,input().split())
H = np.array(list(map(int, input().split())))
ans = list(abs((T - H * 0.006) - A))
print(ans.index(min(ans))+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
N = int(input())
#S = str(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

id = 0
minN = sys.maxsize
for i in range(N):
  ave = abs(A - (T-(H[i] * 0.006)))
  if minN > ave :
    minN = ave
    id = i
print (id+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a  = map(int, input().split())
h = list(map(int, input().split()))
diff = [0]*n

for i in range(n):
  diff[i] = abs(a - t + h[i]*0.006)
  
print(diff.index(min(diff))+1)

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    T, A = MAP()
    H = LIST()

    ans = 1
    for i in range(N-1):
        if abs(A - (T - 0.006 * H[i+1])) < abs(A - (T - 0.006 * H[ans-1])):
            ans = i + 2

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int,input().split()))

mintemp = 10 ** 9
ans = 0
for i in range(n):
    temp = t - (h[i] * 0.006)
    if mintemp > abs(a - temp):
        mintemp = abs(a - temp)
        ans = i
print(ans + 1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
minimum = 10**5
ans = 0
for i in range(N):
    if minimum > abs(A - (T-H[i] * 0.006)):
        minimum = abs(A - (T-H[i] * 0.006))
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 16, Jan, 2020
"""

import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
T, A = map(int, readline().split())
H = np.array([int(x) for x in readline().split()])
# print(H)
H = 1000 * T - H * 6
# print(H)
H = abs(H - A*1000)
# print(H)

ans = 0
tmp = 10000000
for num, i in enumerate(H):
    if tmp >= i:
        ans = num
        tmp = i
print(ans + 1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
dif=9999
ans=0
for i in range(n):
  tmp=abs(a-(t-0.006*H[i]))
  if tmp<dif:
    dif=tmp
    ans=i+1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=0
dist=1000
for i in range(n):
  d=abs(t-h[i]*0.006-a)
  if d<=dist:
    dist=d
    ans=i+1
print(ans)

Submission status: Accepted

Solution code:
def temp(H):
  ans = - H *0.006
  return ans
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
TE = list(map(temp,H))
TLA = list(map(lambda x: abs(T + x -A) , TE))
ans=TLA.index(min(TLA))
print(ans+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
sub=10000000
x=0
for i in range(n):
  if (a-(t-0.006*H[i]))**2<sub:
    sub= (a-(t-0.006*H[i]))**2
    x=i
  i+=1
print(x+1)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
h=float("INF")
pos=0
for i in range(N):
    temp=T-H[i]*0.006
    if abs(temp-A)<h:
        h=abs(temp-A)
        pos=i+1
print(pos)

Submission status: Accepted

Solution code:
n, (T, A),  *D,  = [list(map(int, s.split())) for s in open(0)]
n = n[0]
D = D[0]
di = {}
for i in range(len(D)):
    di[i] = abs(A  - T + D[i] * 0.006)
   
di = sorted(di.items(), key = lambda x:x[1])
print(di[0][0] + 1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
ans = float('INF')
pos = 0
for i in range(n):
  temp = t - h[i] * 0.006
  if abs(temp - a) < ans:
    ans = abs(temp - a)
    pos = i + 1
print(pos)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
t = [(T - H[i] * 0.006) for i in range(N)]
cur = 100000
for i in range(N):
    if (abs(t[i] - A) < cur): cur, ans = abs(t[i] - A), i + 1
print(ans)

Submission status: Accepted

Solution code:
def p_b():
    n = int(input())
    t, a = map(int, input().split())
    *H, = map(int, input().split())
    ans = 10**9
    idx = -1
    for i, h in enumerate(H):
        if ans > abs(a - (t - h * 0.006)):
            ans = abs(a - (t - h * 0.006))
            idx = i + 1
    print(idx)
    
p_b()

Submission status: Accepted

Solution code:
N = int(input())
T,A=map(int,input().split())
H = list(map(int,input().split()))

ans = 100000000000
point = 0

for i in range(N):
    a = (T - H[i]*0.006)
    diff = abs(A - a)
    if diff <= ans:
        ans = diff
        point = i+1
        
print(point)

Submission status: Accepted

Solution code:
N = int(input())
T, A = [int(i) for i in input().split()]
best_height = (A - T) / (-0.006)

H = {abs(best_height - int(n)): i+1 for i, n in enumerate(input().split())}

min_diff = min(H.keys())
print(H[min_diff])

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int,input().split())
pList = list(map(int,input().split()))
tList = []
for i in range(n):
  tList.append(abs(a-(t-pList[i]*0.006)))

result = 0
for i in range(1,n):
  if tList[result] > tList[i]:
    result = i

print(result+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
min_diff = 100000

for i in range(N):
    temp = T - H[i] * 0.006
    diff = abs(temp - A)

    if min_diff > diff:
        min_diff = diff
        ans = i + 1
    
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
print(min([(abs(a-t+h[i]*0.006),i)for i in range(n)])[1]+1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
l = list(map(int,input().split()))
ans = 5000
count = 0
for i in range(n):
  x = t-0.006*l[i]
  if ans > abs(a-x):
    ans = abs(a-x)
    count = i+1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(lambda x: abs(a-(t-int(x)*0.006)) ,input().split()))
print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=[abs(a-(t-int(x)*0.006)) for x in input().split()]
print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
ans=0
min=1000000000
h=list(map(int, input().split()))
for i in range(n):
  b=t-h[i]*0.006
  if min>abs(a-b):
    ans=i+1
    min=abs(a-b)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
def f(x):
    return t - x*0.006

def abm(x):
    return abs(x-a)
h = list(map(f, h))
h = list(map(abm, h))
print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    T,A=map(int,input().split())
    H=list(map(int,input().split()))
    tmp=INF
    for i,h in enumerate(H):
        t=T-0.006*h
        if tmp > abs(t-A):
            ans=i
            tmp=abs(t-A)
    print(ans+1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=[]
for i in range(n):
	ans.append(abs(t-h[i]*0.006-a))
print(ans.index(min(ans))+1)

Submission status: Accepted

Solution code:
# coding: utf-8
N=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
S=[]
for i in range(N):
    S.append(abs(a-(t-H[i]*0.006)))
m=min(S)
print(S.index(m)+1)

Submission status: Accepted

Solution code:
def calc_temp(t, h):
	return t - h * 0.006

n = int(input())
ta = input().split()
t = int(ta[0])
a = int(ta[1])

h = list(map(int,input().split()))

h_len = len(h)

best_abs = None
best_i = None

i = 1
i_abs = None

for h_item in h:

	temperature = calc_temp(t = t, h = h_item)
	i_abs = abs(temperature - a)



	if best_abs == None:
		best_abs = i_abs
		best_i = i

	if best_abs > i_abs:
		best_abs = i_abs
		best_i = i	

	i = i + 1	


print(best_i)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))

pointID = -1
min_diff = 9999999999

for i in range (N):
    #地点i の温度 と 平均気温の差(絶対値)
    diff = abs(T - H[i] * 0.006 - A)

    if diff < min_diff:
        pointID = i+1
        min_diff = diff

print(pointID)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = [int(x) for x in input().split()]

dh = [abs(t-x*0.006-a) for x in h]
print(dh.index(min(dh))+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(lambda x: abs(A - (T - int(x) * 0.006)), input().split()))

print(H.index(min(H)) + 1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
lst = [ abs((t - i * 0.006)-a) for i in list(map(int, input().split()))]
print(lst.index(min(lst)) + 1)

Submission status: Accepted

Solution code:
n = int(input())

t, a = list(map(int, input().split()))

h = list(map(int, input().split()))

h = list(map(lambda x: (abs(a - (t - x[1] * 0.006)), x[0]), enumerate(h)))

h.sort()

print(h[0][1] + 1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

temp = [abs(T - h * 0.006 - A) for h in H] # 各地点の気温- 平均温度 の絶対値が最小になるものが、平均値に一番近いはず
ans = temp.index(min(temp)) + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
h = [abs((T - (int(x) * 0.006)) - A) for x in input().split()]
print(h.index(min(h))+1)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
T, A = map(int, input().split())
h = [abs((T - (int(x) * 0.006)) - A) for x in input().split()]
print(np.argmin(h)+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

# 地点iでの平均気温T_ave = T - Hi * 0.006
# abs(A - T_ave)が最小になるような地点の番号iを求める

# 平均気温T_aveを求めるループ
T_ave = []
diffArray = []
minDiff = 1200000
j_min = 0
for j in range(len(H)):
    T_ave.append(T - H[j]*0.006)
    diffArray.append(abs(A - T_ave[j]))
    if diffArray[j] < minDiff:
        minDiff = diffArray[j]
        j_min = j
# print(diffArray)
print(j_min + 1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
H = [int(i) for i in input().split()]
x = (t-a)/0.006

rs = 0
mid = 99999
for i in range(n):
    if mid > abs(x-H[i]):
        mid = abs(x-H[i])
        rs = i
print(rs+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
t,a = map(int,input().split())
h = list(map(int, input().split()))

ans = 0
tmp = 10 ** 10
for i in range(n):
    if abs(t - h[i] * 0.006 - a) < abs(tmp - a):
        tmp = t - h[i] * 0.006
        ans = i + 1

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
ans=10**9
x=0
for i in range(N):
  a=abs(A*1000-(T*1000-H[i]*6))
  if ans > a:
    ans=a
    x=i
print(x+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
div_min = 10**5
idx = 0
for i in range(N):
    div = abs((T-H[i]*0.006) - A)
    if div_min > div:
        div_min = div
        idx =i+1

print(idx)

Submission status: Accepted

Solution code:
import sys

n, T, A, *h = map(int, sys.stdin.read().split())

def main():
    t = [T - 0.006 * h[i] for i in range(n)]
    d = [(abs(A - t[i]), i+1) for i in range(n)]
    d.sort()
    return d[0][1]

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
a = input()
T,A = map(int,input().split())
li = list(map(int,input().split()))

min = 1000
ans = 0

for index, i in enumerate(li):
  b = T - (i * 0.006)
  if abs(A - b) < min:
    min = abs(A - b)
    ans = index + 1
  
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))


def kion_sa(x):
    return abs((T - x * 0.006) - A)


kionsa_list = list()
for i, x in enumerate(Hs):
    kionsa_list.append((kion_sa(x), i))

kionsa_list.sort()
print(kionsa_list[0][1]+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))

Palace = []

for h in H:
    Palace.append(abs((t - h * 0.006) - a))

print(Palace.index(min(Palace))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))

Palace = []

for i in range(len(H)):
    Palace.append(abs(t - H[i] * 0.006 - a))

print(Palace.index(min(Palace))+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

print(sorted([(i, abs(A - (T - h * 0.006)))
              for i, h in enumerate(Hs, 1)], key=lambda x: x[1])[0][0])

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
ls = [abs(T-h*0.006 - A)for h in list(map(int, input().split()))]
print(ls.index(min(ls)) + 1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
ans = []

l = list(map(int,input().split()))
    
for i in l:
    ans.append(abs(a - (t - (i * 0.006))))

print(ans.index(min(ans))+1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
l = []
m = []
ans = []

l = list(map(int,input().split()))
    
for i in range(n):
    m.append(t - (l[i] * 0.006))

for i in range(n):
    ans.append(a - m[i])

print(ans.index(min(ans,key=abs))+1)

Submission status: Accepted

Solution code:
import sys
N = int(input())

T, A = map(int, input().split())

listH = list(map(int, input().split()))

listT = [T-i*0.006 for i in listH]



min = sys.maxsize
ans = 0
for j in range(0,len(listT)):
    dif = abs(A - listT[j])
    if min > dif:
        min = dif
        ans = j+1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(input())
(T, A) = map(int, input().split(' '))
H = list(map(int, input().split(' ')))

d = 1000000
hi = 0
for i in range(N):
    h = H[i]
    dc = abs(A - (T - 0.006 * h))
    if dc < d:
        d = dc
        hi = i
        # print('{}: d={}, h={}'.format(i + 1, d, h))

print(hi + 1)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
num=float("inf")
ans=0
for i in range(N):
    H[i]=T-0.006*H[i]
    if abs(A-H[i])<num:
        ans=i+1
        num=abs(A-H[i])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
print(min(range(N), key=lambda i:abs(T-H[i]*0.006-A))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

dif = []

for i in range(n):
    kion = t - h[i]*0.006
    dif.append(abs(a-kion))
print(dif.index(min(dif))+1)

Submission status: Accepted

Solution code:
import numpy as np

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))

hh=np.array(h)

temp=abs(a-(t-hh*0.006))

ans=np.argmin(temp)

print(ans+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans,sa=1,abs(a-(t-h[0]*0.006))
for i in range(1,n):
    if sa>abs(a-(t-h[i]*0.006)):
        ans,sa=i+1,abs(a-(t-h[i]*0.006))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
H = list(map(int,input().split()))
diff = []
for i in range(n):
    temp = t - H[i]*0.006
    diff.append(abs(temp-a))
print(diff.index(min(diff))+1)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
T,A = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
d = 1000000000000
index = 0
for i in range(N) :
    dT = T - H[i] * 0.006
    dd = abs(A - dT)
    if dd < d :
        d = dd
        index = i
print(index+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
min_diff = 100000
for i in range(N):
  temp = T - H[i]*0.006
  if abs(A-temp) < min_diff:
    ans = i+1
    min_diff = abs(A-temp)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))

ans = -1
dif = 10**6
for i in range(n):
    if abs(t-0.006*H[i]-a) < dif:
        dif = abs(t-0.006*H[i]-a)
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())

H=list(map(int,input().split()))
diff=[abs(A-(T-h*0.006)) for h in H]
print(diff.index(min(diff))+1)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    T,A = map(int,input().split())
    H = list(map(int,input().split()))
    temp = 10**10
    ans = -1
    for i in range(N):
        if temp > abs(T-H[i]*0.006-A):
            ans = i
            temp = abs(T-H[i]*0.006-A)
            
    print(ans+1)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def solve():
    N, T, A, *H = map(int, open(0).read().split())
    
    aveT = [0] * N
    for i in range(N):
        aveT[i] = T - H[i] * 0.006
    
    ans, d_min = 0, 10 ** 5
    for i in range(N):
        if abs(A - aveT[i]) < d_min:
            ans = i + 1
            d_min = abs(A - aveT[i])
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N =  int(sys.stdin.buffer.readline())
T, A = list(map(int, sys.stdin.buffer.readline().split()))
H = list(map(int, sys.stdin.buffer.readline().split()))
H = np.array(H, dtype=float)

ans = np.argmin(np.abs((T - H * 0.006) - A))
print(ans + 1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 1
dif = abs(A - (T - H[0] * 0.006))
for i in range(1, N):
    if dif > abs(A - (T - H[i] * 0.006)):
        dif = abs(A - (T - H[i] * 0.006))
        ans = i + 1
print(ans)

Submission status: Accepted

Solution code:
#113 b-palce
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
mini=10**6
ans=0
for i in range(len(h)):
    kion=t-0.006*h[i]
    sa=abs(a-kion)
    if sa<mini:
        mini=sa
        ans=i+1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

pointCount = int(input())
(t, a) = [int(i) for i in input().rstrip().split(" ")]

point_lit = [int(i) for i in input().rstrip().split(" ")]


min_diff = 100000
ans = 0
for i in range(len(point_lit)):
    kion = t - (point_lit[i] * 0.006)
    diff = abs(a - kion)
    if diff < min_diff:
        min_diff = diff
        ans = i + 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
x=[]

for i in range(n):
    x.append(abs(a-(t-h[i]*0.006)))

print(x.index(min(x))+1)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
l=[int(i) for i in input().split()]
d=[]
for i in l:
  d.append((abs(A - (T-i*0.006))))
print(d.index(min(d))+1)

Submission status: Accepted

Solution code:
def dif(h):
  return (abs(A - (T-l[0]*0.006)))
  

N=int(input())
T,A=map(int,input().split())
l=[int(i) for i in input().split()]
d=[]
for i in l:
  d.append((abs(A - (T-i*0.006))))
print(d.index(min(d))+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 1000000

for i, h in enumerate(H):
    temp = T - h * 0.006
    if abs(temp - A) < ans:
        ans = min(ans, abs(temp - A))
        idx = i+1
print(idx)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))
    for i in range(N):
        H[i] = abs(A - (T- H[i] * 0.006))
    print(H.index(min(H))+1)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
def main():
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))
    for i in range(N):
        H[i] = T- H[i] * 0.006
    
    print(np.abs(np.asarray(H) - A).argmin()+1)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
t, a= map(int,input().split())

H = list(map(int, input().split()))


A = []

for i in H:
    A.append(abs(a - (t - i*0.006)))
print(A.index(min(A))+1)

Submission status: Accepted

Solution code:

N = int(input())
T, A = map(int, input().split())

elev_counted =[abs((T-x*0.006)-A) for x in map(int,input().split())]

print(elev_counted.index(min(elev_counted))+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int, input().split())

h_list = list(map(int, input().split()))
a_list = []
for h in h_list:
    candi = T - h * 0.006
    ac = float(abs(candi - A))
    a_list.append(ac)
print(a_list.index(min(a_list)) + 1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))

memo = 10**5
for i in range(n):
    if abs((t-h[i]*0.006)-a) < memo:
        ans = i+1
        memo = abs((t-h[i]*0.006)-a)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

difference = []
for i in range(N):
    tmp = T - (H[i] * 0.006)
    difference.append(abs(A-tmp))

print(difference.index(min(difference))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
lst = []

for i in range(n):
    lst.append(abs(a-(t-h[i]*0.006)))

for i in range(n):
    if lst[i]==min(lst):
        print(i+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=10000000
for i in range(n):
    f=t-h[i]*0.006
    if m>abs(a-f):
        m=abs(a-f)
        ans=i+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tempmin = 10**5
ans = 0

for i,height in enumerate(h,1):
    temp = abs(a-(t-height*0.006))
    if tempmin > temp:
        ans = i
        tempmin = temp

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tempmin = 10**5
ans = 0

for i,h in enumerate(h,1):
    temp = abs(a-(t-h*0.006))
    if tempmin > temp:
        ans = i
        tempmin = temp

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tempmin = 10**5

for i,h in enumerate(h,1):
    temp = abs(a-(t-h*0.006))
    if tempmin > temp:
        ans = i
        tempmin = temp

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
T, A = map(int,input().split())
li_H = list(map(int, input().split()))
index = 0
min = 1000000
for i in range(N):
     temp = abs(T-li_H[i]*0.006 - A)
     if temp < min:
         index = i+1
         min = temp
print(index)

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int, input().split())
h = list(map(int, input().split())) 

k=[]
minsa=10000000
for i in range(n):
  sa= abs(a-h[i]*0.006-b)
  minsa=(min(sa,minsa))
  k.append(sa)
print(k.index(minsa)+1)

Submission status: Accepted

Solution code:
N = int(input())
num = list(map(int,input().split()))
temp = list(map(int,input().split()))
ans=0
distance=1000000
for i in range(len(temp)):
	if(abs(num[1]-(num[0]-temp[i]*0.006))<distance):
		ans=i+1
		distance=abs(num[1]-(num[0]-temp[i]*0.006))
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
hl=list(map(int,input().split()))
gap=abs(a-(t-hl[0]*0.006))
#print(gap)
city=1
for i in range(2,n+1):
    temp_gap=abs(a-(t-hl[i-1]*0.006))
    #print(i,temp_gap)
    if temp_gap<gap:
        gap=temp_gap
        city=i
print(city)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
ln=[t-0.006*int(a) for a in input().split()]
lm=[]
for x in ln:
    lm.append(abs(a-x))
print(lm.index(min(lm))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
index = 0
Min = 1000
for i in range(n):
    A = t-h[i]*0.006
    if abs(a-A) < Min:
        Min = abs(a-A)
        index = i
print(index+1)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H = list(map(int,input().split()))
ind = -1
dis = 10**5
for i in range(len(H)):
  dx = abs(A - (T-H[i]*0.006))
  if dis > dx:
    dis = dx
    ind = i
print(ind+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
lis=[]
for i in range(n):
  lis.append([abs(t-h[i]*0.006-a),i+1])
lis.sort()
print(lis[0][1])

Submission status: Accepted

Solution code:
def examA():
    X, Y = LI()
    ans = X + Y//2
    print(ans)
    return

def examB():
    N = I()
    T, A = LI()
    H = LI()
    cur = 10**9; ans = 0
    for i in range(N):
        now = abs(A - (T - H[i]*0.006))
        if cur>now:
            cur = now
            ans = i
    print(ans+1)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()

Submission status: Accepted

Solution code:
import sys
n = int(input())
t,a = map(int, sys.stdin.readline().split())
h = list(map(int, sys.stdin.readline().split()))

ans = 0
temp = 100000000
for i in range(len(h)):
    temperature = t - h[i] * 0.006
    if abs(temperature - a) < temp:
        temp = abs(temperature - a)
        ans = i + 1
    

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T,A = list(map(int,input().split()))
H = list(map(int,input().split()))

tmp = 10000000
for i in range(N):
  if tmp >= abs(A - (T - (H[i] * 0.006))):
    tmp = abs(A - (T - (H[i] * 0.006)))
    ans = i + 1
print(ans)