problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03774
u373499377
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['def main():\n n, m = map(int, input().split())\n students = [tuple(map(int, input().split())) for i in range(n)]\n check_points = [tuple(map(int, input().split())) for i in range(m)]\n\n for a, b in students:\n dist = [abs(a - c) + abs(b - d) for c, d in check_points]\n print(min(dist) + 1)\n\n # for st in students:\n \n # for pt in check_points:\n # if abs(pt[0] - st[0]) + abs(pt[1] - st[1]) < \\\n # abs(min_pt[0] - st[0]) + abs(min_pt[1] - st[1]):\n # min_pt = pt\n # print(check_points.index(min_pt) + 1)\n\n\nif __name__ == "__main__":\n\n main()\n', 'def main():\n n, m = map(int, input().split())\n students = [tuple(map(int, input().split())) for i in range(n)]\n check_points = [tuple(map(int, input().split())) for i in range(m)]\n\n for a, b in students:\n dist = [abs(a - c) + abs(b - d) for c, d in check_points]\n print(check_points.index(min(dist) + 1))\n \n # for st in students:\n \n # for pt in check_points:\n # if abs(pt[0] - st[0]) + abs(pt[1] - st[1]) < \\\n # abs(min_pt[0] - st[0]) + abs(min_pt[1] - st[1]):\n # min_pt = pt\n # print(check_points.index(min_pt) + 1)\n\n\nif __name__ == "__main__":\n\n main()\n', 'def main():\n n, m = map(int, input().split())\n students = [tuple(map(int, input().split())) for i in range(n)]\n check_points = [tuple(map(int, input().split())) for i in range(m)]\n\n for a, b in students:\n dist = [abs(a - c) + abs(b - d) for c, d in check_points]\n print(dist.index(min(dist)) + 1)\n\n # for st in students:\n \n # for pt in check_points:\n # if abs(pt[0] - st[0]) + abs(pt[1] - st[1]) < \\\n # abs(min_pt[0] - st[0]) + abs(min_pt[1] - st[1]):\n # min_pt = pt\n # print(check_points.index(min_pt) + 1)\n\n\nif __name__ == "__main__":\n\n main()\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s065297787', 's592037099', 's732192401']
[3060.0, 3060.0, 3060.0]
[18.0, 18.0, 19.0]
[653, 681, 665]
p03774
u393512980
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\na_b=[list(map(int,input().split()) for _ in range(n)]\nc_d=sorted([list(map(int,input().split()) for _ in range(m)])\nfor i in range(n):\n res=1\n d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])\n for j in range(m):\n t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])\n if t<d:\n d=t\n res=j+1\n print(res)\n \n ', 'n,m=map(int,input().split())\na_b=[list(map(int,input().split())) for _ in range(n)]\nc_d=[list(map(int,input().split())) for _ in range(m)]\nfor i in range(n):\n res=1\n d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])\n for j in range(1,m):\n t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])\n if t<d:\n d=t\n res=j+1\n print(res)\n \n']
['Runtime Error', 'Accepted']
['s273762090', 's538891366']
[2940.0, 3064.0]
[18.0, 19.0]
[359, 351]
p03774
u408791346
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n, m = map(int,input().split())\nab = list(list(map(int, input().split())) for _ in range(n))\ncd = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(n):\n for j in range(m):\n num = []\n num.append(abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]))\n else:\n mini = min(num)\n print(num.index(mini)+1)\n num = []', 'n, m = map(int,input().split())\nab = list(list(map(int, input().split())) for _ in range(n))\ncd = list(list(map(int, input().split())) for _ in range(m))\n\nfor i in range(n):\n num = []\n for j in range(m):\n num.append(abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]))\n else:\n mini = min(num)\n print(num.index(mini)+1)\n num = []']
['Wrong Answer', 'Accepted']
['s231660999', 's145161314']
[3064.0, 3064.0]
[19.0, 19.0]
[363, 359]
p03774
u430478288
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n, m = map(int, input().split())\nstu = []\ncheck = []\nfor i in range(n):\n stu.append(list(map(int, input().split())))\n\nfor i in range(m):\n check.append(list(map(int, input().split())))\n\n\nans = []\n\nfor i in range(n):\n dist = []\n for j in range(m):\n tmp = abs(stu[i][0] - check[j][0]) + abs(stu[i][1] - check[j][1])\n dist.append(tmp)\n mi = dist.index(min(dist))\n ans.append(mi)\n\n\nfor i in range(len(ans)):\n print(ans[i])\n\n\n', 'n, m = map(int, input().split())\nstu = []\ncheck = []\nfor i in range(n):\n stu.append(list(map(int, input().split())))\n\nfor i in range(m):\n check.append(list(map(int, input().split())))\n\n\nans = []\n\nfor i in range(n):\n dist = []\n for j in range(m):\n tmp = abs(stu[i][0] - check[j][0]) + abs(stu[i][1] - check[j][1])\n dist.append(tmp)\n mi = dist.index(min(dist))\n ans.append(mi)\n\n\nfor i in range(len(ans)):\n print(ans[i] + 1)']
['Wrong Answer', 'Accepted']
['s649047598', 's368000102']
[3064.0, 3064.0]
[19.0, 19.0]
[455, 456]
p03774
u450145303
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N,M = list(map(int, input().split()))\n \ns = [list(map(int,input().split())) for i in range(n)]\nc = [list(map(int,input().split())) for j in range(n)]\n \nfor t1 in s:\n l = list(map(lambda x: abs(t1[0] - x[0]) + abs(t1[1] - x[1]), c))\n print(l.index(min(l)) + 1)', 'N,M = list(map(int, input().split()))\n \ns = [list(map(int,input().split())) for i in range(N)]\nc = [list(map(int,input().split())) for j in range(M)]\n \nfor t1 in s:\n l = list(map(lambda x: abs(t1[0] - x[0]) + abs(t1[1] - x[1]), c))\n print(l.index(min(l)) + 1)']
['Runtime Error', 'Accepted']
['s833898176', 's878093356']
[3064.0, 3064.0]
[17.0, 19.0]
[265, 265]
p03774
u457554982
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['[n,m]=list(map(int,input().split()))\nab=[]\nfor i in range(n):\n ab.append(list(map(int,input().split())))\ncd=[]\nfor i in range(m):\n cd.append(list(map(int,input().split())))\nans=[]\nfor i in range(n):\n kyorimin=10**9\n for j in range(m):\n kyori=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n if kyorimin>kyori:\n goal=j+1\n ans.append(goal)\nfor i in range(len(ans)):\n print(ans[i])', '[n,m]=list(map(int,input().split()))\nab=[]\nfor i in range(n):\n ab.append(list(map(int,input().split())))\ncd=[]\nfor i in range(m):\n cd.append(list(map(int,input().split())))\nans=[]\nfor i in range(n):\n kyorimin=10**9\n for j in range(m):\n kyori=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])\n if kyorimin>kyori:\n goal=j+1\n kyorimin=kyori\n ans.append(goal)\nfor i in range(len(ans)):\n print(ans[i])']
['Wrong Answer', 'Accepted']
['s408904411', 's168390150']
[3064.0, 3064.0]
[19.0, 19.0]
[419, 446]
p03774
u461833298
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\nman = [[int(x) for x in input().split()] for _ in range(N)]\ncheck = [[int(x) for x in input().split()] for _ in range(M)]\n\nfor a, b in man:\n tmp = 1000000000\n ans = 1\n for i, (c, d) in enumerate(check):\n if tmp > (abs(a-c) + abs(b-d)):\n tmp = min(tmp, abs(a-c) + abs(b-d))\n print(ans)', 'N, M = map(int, input().split())\nman = [[int(x) for x in input().split()] for _ in range(N)]\ncheck = [[int(x) for x in input().split()] for _ in range(M)]\n\nfor a, b in man:\n tmp = 1000000000\n ans = 1\n for i, (c, d) in enumerate(check):\n if tmp > (abs(a-c) + abs(b-d)):\n tmp = min(tmp, abs(a-c) + abs(b-d))\n ans = i+1\n print(ans)']
['Wrong Answer', 'Accepted']
['s123617413', 's976409212']
[3064.0, 3064.0]
[19.0, 18.0]
[347, 369]
p03774
u462626125
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['import os\nimport sys\n\n\ndef manhatten(tupleA,tupleB):\n\treturn abs(tupleA[0]-tupleB[0]) + abs(tupleA[1]-tupleB[1])\n\nheader = input().split()\nN,M = int(header[0]),int(header[1])\nstudents = []\ncheckpoints = []\n\nfor i in range(N):\n\tstudent = input().split()\n\tstudent = [int(x) for x in student]\n\tstudents.append(tuple(student))\n\nfor i in range(M):\n\tcheckpoint =input().split()\n\tcheckpoint = [int(x) for x in checkpoint]\n\tcheckpoints.append(tuple(checkpoint))\n\nfor student in students:\n\tdistance = []\n\tfor checkpoint in checkpoints:\n\t\td = manhatten(student,checkpoint)\n\t\tdistance.append(d)\n\tprint(distance)\n\tprint(distance.index(min(distance))+ 1)', 'import os\nimport sys\n\n\ndef manhatten(tupleA,tupleB):\n\treturn abs(tupleA[0]-tupleB[0]) + abs(tupleA[1]-tupleB[1])\n\nheader = input().split()\nN,M = int(header[0]),int(header[1])\nstudents = []\ncheckpoints = []\n\nfor i in range(N):\n\tstudent = input().split()\n\tstudent = [int(x) for x in student]\n\tstudents.append(tuple(student))\n\nfor i in range(M):\n\tcheckpoint =input().split()\n\tcheckpoint = [int(x) for x in checkpoint]\n\tcheckpoints.append(tuple(checkpoint))\n\nfor student in students:\n\tdistance = []\n\tfor checkpoint in checkpoints:\n\t\td = manhatten(student,checkpoint)\n\t\tdistance.append(d)\n\tprint(distance.index(min(distance))+ 1)']
['Wrong Answer', 'Accepted']
['s828182637', 's147775150']
[3064.0, 3064.0]
[19.0, 19.0]
[641, 624]
p03774
u468972478
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n, m = map(int, input().split())\np = [list(map(int, input().split())) for i in range(n + m)]\nfor a, b in p[:n]:\n x = [abs(a - c) + abs(b - d) for c, d in p[n:]]\nprint(x.index(min(x)) + 1)', 'n, m = map(int, input().split())\na = [input().split() for i in range(n)]\nc = []\nfor i in range(n):\n for j in range(m):\n b = input().split()\n c.append(abs(a[i][0] - b[0]) + abs(a[i][1] - b[1]))\n print(c.index(min(c)))\n \n \n ', 'n, m = map(int, input().split())\np = [list(map(int, input().split())) for i in range(n + m)]\nfor a, b in p[:n]:\n x = [abs(a - c) + abs(b - d) for c, d in p[n:]]\n print(x.index(min(x)) + 1)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s098746667', 's829237760', 's864755452']
[9076.0, 9072.0, 8944.0]
[30.0, 26.0, 27.0]
[188, 234, 190]
p03774
u474630266
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
["N, M = map(int, input().split())\n\nnodes, checks = [], []\nfor i in range(N):\n nodes.append(map(int, input().split()))\nfor j in range(M):\n checks.append(map(int, input().split()))\n\nfor i in range(N):\n argMin, distMin = None, float('inf')\n for j in range(M):\n dist = abs(nodes[i][0] - checks[j][0]) + abs(nodes[i][1] - checks[j][1])\n if dist < distMin: argMin, distMin = j, dist\n print(j)", "N, M = map(int, input().split())\n\nnodes, checks = [], []\nfor i in range(N):\n nodes.append(list(map(int, input().split())))\n\nfor j in range(M):\n checks.append(list(map(int, input().split())))\n\nfor i in range(N):\n argMin, distMin = None, float('inf')\n for j in range(M):\n dist = abs(nodes[i][0] - checks[j][0]) + abs(nodes[i][1] - checks[j][1])\n if dist < distMin: argMin, distMin = j, dist\n print(argMin + 1)"]
['Runtime Error', 'Accepted']
['s900705143', 's426783979']
[3064.0, 3064.0]
[17.0, 19.0]
[414, 436]
p03774
u476435125
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N,M=map(int,input().split())\nlab=[]\nfor i in range(N):\n lab.append(list(map(int,input().split())))\nlcd=[]\nfor i in range(N):\n lcd.append(list(map(int,input().split())))\nfor i in range(N):\n dmin=10**9\n for j in range(M):\n\n if abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])<dmin:\n dmin=abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])\n print(dmin)\n', 'N,M=map(int,input().split())\nlab=[]\nfor i in range(N):\n lab.append(list(map(int,input().split())))\nlcd=[]\n\nfor i in range(M):\n lcd.append(list(map(int,input().split())))\nfor i in range(N):\n dmin=10**9\n ans=1\n for j in range(M):\n\n if abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])<dmin:\n #print(abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1]))\n dmin=abs(lab[i][0]-lcd[j][0])+abs(lab[i][1]-lcd[j][1])\n ans=j+1\n #print(dmin)\n \n print(ans)\n']
['Runtime Error', 'Accepted']
['s121791971', 's142939938']
[3064.0, 3064.0]
[19.0, 19.0]
[383, 590]
p03774
u481333386
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['# -*- coding: utf-8 -*-\n\n\ndef solve(s_pp, p_pp):\n p_nums = []\n for x, y in s_pp:\n distance = []\n for xx, yy in p_pp:\n n = abs(x, xx) + abs(y, yy)\n distance.append(n)\n p_nums.append(min(distance))\n return p_nums\n\n\ndef main():\n students, points = [int(e) for e in input().split()]\n students_ps = []\n points_ps = []\n\n for _ in range(students):\n x, y = [int(e) for e in input().split()]\n students_ps.append([x, y])\n for _ in range(points):\n x, y = [int(e) for e in input().split()]\n points_ps.append([x, y])\n \n for answer in solve(students_ps, points_ps):\n print(answer)\n\n\nmain()\n', '# -*- coding: utf-8 -*-\n\n\ndef solve(s_pp, p_pp):\n p_nums = []\n for x, y in s_pp:\n distance = []\n for xx, yy in p_pp:\n n = abs(x - xx) + abs(y - yy)\n distance.append(n)\n min_distance_idx = distance.index(min(distance))\n p_nums.append(min_distance_idx + 1)\n return p_nums\n\n\ndef main():\n students, points = [int(e) for e in input().split()]\n students_ps = []\n points_ps = []\n\n for _ in range(students):\n x, y = [int(e) for e in input().split()]\n students_ps.append([x, y])\n for _ in range(points):\n x, y = [int(e) for e in input().split()]\n points_ps.append([x, y])\n \n for answer in solve(students_ps, points_ps):\n print(answer)\n\n\nm', '# -*- coding: utf-8 -*-\n\n\ndef solve(s_pp, p_pp):\n p_nums = []\n for x, y in s_pp:\n distance = []\n for xx, yy in p_pp:\n n = abs(x - xx) + abs(y - yy)\n distance.append(n)\n min_distance_idx = distance.index(min(distance))\n p_nums.append(min_distance_idx + 1)\n return p_nums\n\n\ndef main():\n students, points = [int(e) for e in input().split()]\n students_ps = []\n points_ps = []\n\n for _ in range(students):\n x, y = [int(e) for e in input().split()]\n students_ps.append([x, y])\n for _ in range(points):\n x, y = [int(e) for e in input().split()]\n points_ps.append([x, y])\n \n for answer in solve(students_ps, points_ps):\n print(answer)\n\n\nmain()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s502516128', 's696847718', 's181194254']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[684, 744, 750]
p03774
u494748969
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n, m = list(map(int, input().split()))\na = [0] * n\nb = [0] * n\nfor i in range(n):\n a[i], b[i] = list(map(int, input().split()))\nc = [0] * m\nd = [0] * m\nfor j in range(m):\n c[j], d[j] = list(map(int, input().split()))\n\nfor i in range(n):\n distance = []\n minDistance = 10 ** 8 + 1\n checkPoint = 1\n for j in range(m):\n if j == 0:\n checkPoint = 1\n else:\n distance.append(abs(a[i] - c[j]) + abs(b[i] - d[j]))\n if minDistance > distance[j]:\n minDistance = distance[j]\n checkPoint = j + 1\n print(checkPoint)', 'n, m = list(map(int, input().split()))\na = [0] * n\nb = [0] * n\nfor i in range(n):\n a[i], b[i] = list(map(int, input().split()))\nc = [0] * m\nd = [0] * m\nfor j in range(m):\n c[j], d[j] = list(map(int, input().split()))\n\nfor i in range(n):\n distance = []\n minDistance = 10 ** 16\n checkPoint = 1\n for j in range(m):\n distance.append(abs(a[i] - c[j]) + abs(b[i] - d[j]))\n if minDistance > distance[j]:\n minDistance = distance[j]\n checkPoint = j + 1\n print(checkPoint)']
['Runtime Error', 'Accepted']
['s794510417', 's191694519']
[3192.0, 3064.0]
[18.0, 19.0]
[598, 519]
p03774
u505420467
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\na=[]\nb=[]\nc=[]\nd=[]\nans=0\nans1=0\ntmp=0\nfor i in range(n):\n x,y=map(int,input().split())\n a.append(x)\n b.append(y)\nfor i in range(m):\n x,y=map(int,input().split())\n c.append(x)\n d.append(y)\nfor i in range(n):\n for j in range(m):\n tmp=abs(a[i]-c[j])+abs(b[i]-d[j])\n if j==0:\n ans=tmp\n if ans>tmp:\n ans1=j+1\n ans=tmp\n print(ans1)\n', 'n,m=map(int,input().split())\nans=10**9\ntmp_ans=10**9\nprin=0\na=[]\nb=[]\nfor i in range(n):\n x,y=map(int,input().split())\n a.append([x,y])\nfor i in range(m):\n x,y=map(int,input().split())\n b.append([x,y])\nfor i in range(n):\n tmp_x=a[i][0]\n tmp_y=a[i][1]\n for j in range(m):\n ans=min((abs(tmp_x-b[j][0])+abs(tmp_y-b[j][1])),ans)\n if tmp_ans!=ans:\n prin=j+1\n tmp_ans=ans\n print(prin)\n ans=10**9\n tmp_ans=10**9\n']
['Wrong Answer', 'Accepted']
['s545061965', 's672028105']
[3064.0, 3064.0]
[19.0, 20.0]
[434, 471]
p03774
u518042385
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\nl1=[]\nl2=[]\nfor i in range(n):\n l1.append(list(map(int,input().split())))\nfor i in range(m):\n l2.append(list(map(int,input().split())))\nfor i in range(n):\n l=abs(l1[i][0]-l2[0][0])+abs(l1[i][1]-l2[0][1])\n for j in range(1,m):\n if l>abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1]):\n l=abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1])\n else:\n pass\n print(l)\n ', 'n,m=map(int,input().split())\nl1=[]\nl2=[]\nfor i in range(n):\n l1.append(list(map(int,input().split())))\nfor i in range(m):\n l2.append(list(map(int,input().split())))\nfor i in range(n):\n l=abs(l1[i][0]-l2[0][0])+abs(l1[i][1]-l2[0][1])\n n=0\n for j in range(1,m):\n if l>abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1]):\n l=abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1])\n n=j\n else:\n pass\n print(n)', 'n,m=map(int,input().split())\nl1=[]\nl2=[]\nfor i in range(n):\n l1.append(list(map(int,input().split())))\nfor i in range(m):\n l2.append(list(map(int,input().split())))\nfor i in range(n):\n l=abs(l1[i][0]-l2[0][0])+abs(l1[i][1]-l2[0][1])\n n=0\n for j in range(1,m):\n if l>abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1]):\n l=abs(l1[i][0]-l2[j][0])+abs(l1[i][1]-l2[j][1])\n n=j\n else:\n pass\n print(n+1)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s292812348', 's995582559', 's341605123']
[3064.0, 3064.0, 3064.0]
[19.0, 18.0, 19.0]
[403, 416, 419]
p03774
u518064858
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\nh=[]\np=[]\ndef man(a,c,b,d):\n s=abs(a-b)+abs(c-d)\n return s\nfor i in range(n):\n h.append(list(map(int,input().split())))\nfor j in range(m):\n p.append(list(map(int,input().split())))\nfor k in range(n):\n l=float("inf")\n for v in range(m):\n x=man(h[k][0],p[v][0],h[k][1],p[v][1])\n if x<l:\n l=x\n print(l)\n\n \n\n', 'n,m=map(int,input().split())\nh=[]\np=[]\ndef man(a,c,b,d):\n s=abs(a-b)+abs(c-d)\n return s\nfor i in range(n):\n h.append(list(map(int,input().split())))\nfor j in range(m):\n p.append(list(map(int,input().split())))\nfor k in range(n):\n l=float(inf)\n for v in range(m):\n x=man(h[k][0],p[v][0],h[k][1],p[v][1])\n if x<l:\n l=x\n print(l)\n\n ', 'n,m=map(int,input().split())\nh=[]\np=[]\ndef man(a,c,b,d):\n s=abs(a-c)+abs(b-d)\n return s\nfor i in range(n):\n h.append(list(map(int,input().split())))\nfor j in range(m):\n p.append(list(map(int,input().split())))\nfor k in range(n):\n l=float("inf")\n for v in range(m):\n x=man(h[k][0],p[v][0],h[k][1],p[v][1])\n if x<l:\n l=x\n y=v+1\n print(y)\n\n \n\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s027838193', 's621089888', 's345352636']
[3064.0, 3064.0, 3064.0]
[19.0, 18.0, 20.0]
[382, 378, 400]
p03774
u528720841
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\ns = []\nfor i in range(0, N):\n x, y = map(int, input().split())\n s.append([x, y])\nc = []\nfor i in range(0, M):\n x, y = map(int, input().split())\n s.append([x, y])\n \nfor x,y in s:\n dist_min = 10000000000\n min_n = 0\n n = 0\n for c, d in c:\n n += 1\n dist = abs(x-c)+ abs(y-d)\n if dist_min > dist:\n dist_min = dist\n min_n = n\n print(min_n)', 'N, M = map(int, input().split())\ns = []\nfor i in range(0, N):\n x, y = map(int, input().split())\n s.append([x, y])\nch = []\nfor i in range(0, M):\n x, y = map(int, input().split())\n ch.append([x, y])\n \nfor x,y in s:\n dist_min = 10000000000\n min_n = 0\n n = 0\n for c, d in ch:\n n += 1\n dist = abs(x-c)+ abs(y-d)\n if dist_min > dist:\n dist_min = dist\n min_n = n\n print(min_n)']
['Wrong Answer', 'Accepted']
['s211527057', 's036644174']
[3064.0, 3064.0]
[17.0, 19.0]
[395, 398]
p03774
u535659144
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\na=[list(map(int,input().split())) for a in range(n)]\nc=[list(map(int,input().split())) for b in range(m)]\nprint(a)\nprint(c)\ndist=0\nminnum=0\nfor indi,i in enumerate(a):\n dist=0\n min=10*14\n for indj,j in enumerate(c):\n dist+=abs(i[0]-j[0])\n dist+=abs(i[1]-j[1])\n if min>dist:\n min=dist\n minnum=indj\n print(dist)\n dist=0 \n print(minnum+1)', 'n,m=map(int,input().split())\na=[list(map(int,input().split())) for a in range(n)]\nc=[list(map(int,input().split())) for b in range(m)]\ndist=0\nminnum=0\nfor indi,i in enumerate(a):\n min=10**10\n minnum=0\n for indj,j in enumerate(c):\n dist=0 \n dist+=abs(i[0]-j[0])\n dist+=abs(i[1]-j[1])\n #print("dist={}".format(dist))\n if min>dist:\n min=dist\n minnum=indj\n print(minnum+1)']
['Wrong Answer', 'Accepted']
['s200979790', 's627595941']
[3064.0, 3064.0]
[19.0, 19.0]
[437, 437]
p03774
u539517139
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int, input().split())\ns=[list(map(int, input().split())) for _ in range(n)]\nc=[list(map(int, input().split())) for _ in range(m)]\nfor a,b in s:\n k=[]\n for c,d in c:\n k.append(abs(a-c)+abs(b-d))\n print(k.index(min(k))+1)', 'n,m=map(int, input().split())\ns=[list(map(int, input().split())) for _ in range(n)]\no=[list(map(int, input().split())) for _ in range(m)]\nfor a,b in s:\n k=[]\n for c,d in o:\n k.append(abs(a-c)+abs(b-d))\n print(k.index(min(k))+1)']
['Runtime Error', 'Accepted']
['s578993694', 's229161021']
[3060.0, 3060.0]
[17.0, 18.0]
[233, 233]
p03774
u551109821
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N,M = map(int,input().split())\nA = []\nB = []\nC = []\nD = []\nans = []\n\nfor i in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nfor j in range(M):\n c,d = map(int,input().split())\n C.append(c)\n D.append(d)\n\nfor i in range(N):\n item = abs(A[i]-C[0])-abs(B[i]-D[0])\n index = 1\n for j in range(M):\n if item > abs(A[i]-C[j])-abs(B[i]-D[j]):\n item = abs(A[i]-C[j])-abs(B[i]-D[j])\n index = j+1\n\nfor i in range(len(ans)):\n print(ans[i])\n', 'N,M = map(int,input().split())\nA = []\nB = []\nC = []\nD = []\nans = []\n\nfor i in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nfor j in range(M):\n c,d = map(int,input().split())\n C.append(c)\n D.append(d)\n\nfor i in range(N):\n item = abs(A[i]-C[0])-abs(B[i]-D[0])\n index = 1\n for j in range(M):\n if item > abs(A[i]-C[j])-abs(B[i]-D[j]):\n item = abs(A[i]-C[j])-abs(B[i]-D[j])\n index = j+1\n print(index)\n\nfor i in range(len(ans)):\n print(ans[i])', 'N,M = map(int,input().split())\nA = []\nB = []\nC = []\nD = []\nans = []\n\nfor i in range(N):\n a,b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nfor j in range(M):\n c,d = map(int,input().split())\n C.append(c)\n D.append(d)\n\nfor i in range(N):\n item = abs(A[i]-C[0])+abs(B[i]-D[0])\n index = 1\n for j in range(M):\n if item > abs(A[i]-C[j])+abs(B[i]-D[j]):\n item = abs(A[i]-C[j])+abs(B[i]-D[j])\n index = j+1\n ans.append(index)\n\nfor i in range(len(ans)):\n print(ans[i])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s609754204', 's633561124', 's219722371']
[3064.0, 3064.0, 3064.0]
[19.0, 19.0, 19.0]
[507, 531, 528]
p03774
u557494880
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N,M = map(int,input().split())\ngakusei = []\nfor i in range(N):\n a,b = map(int,input().split())\n gakusei.append((a,b))\ncheck = []\nfor i in range(1,M+1):\n c,d = map(int,input().split())\n check.append((c,d))\nfor i in range(N):\n a,b = gakusei[i]\n z = 10**9\n m = 0\n for j in range(1,M+1):\n c,d = check[j-1]\n x = max(a-c,c-a) + max(b-d,d-b)\n if x < z:\n m = j\n z = x\n print(z)\n ', 'N,M = map(int,input().split())\ngakusei = []\nfor i in range(N):\n a,b = map(int,input().split())\n gakusei.append((a,b))\ncheck = []\nfor i in range(1,M+1):\n c,d = map(int,input().split())\n check.append((c,d))\nfor i in range(N):\n a,b = gakusei[i]\n z = 10**9\n m = 0\n for j in range(1,M+1):\n c,d = check[j-1]\n x = max(a-c,c-a) + max(b-d,d-b)\n if x < z:\n m = j\n z = x\n print(m)']
['Wrong Answer', 'Accepted']
['s313610421', 's927113240']
[3064.0, 3064.0]
[19.0, 19.0]
[448, 439]
p03774
u588081069
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = list(map(int, input().split()))\nSt = [input().split() for _ in range(N)]\nCh = [input().split() for _ in range(M)]\n\nprint(St)\nfor i in range(N):\n memo = []\n for j in range(M):\n diff = abs(int(St[i][0]) - int(Ch[j][0])) + abs(int(St[i][1]) - int(Ch[j][1]))\n memo.append(diff)\n print(memo.index(min(memo)) + 1)\n', 'N, M = list(map(int, input().split()))\nSt = [input().split() for _ in range(N)]\nCh = [input().split() for _ in range(M)]\n\nfor i in range(N):\n memo = []\n for j in range(M):\n diff = abs(int(St[i][0]) - int(Ch[j][0])) + abs(int(St[i][1]) - int(Ch[j][1]))\n memo.append(diff)\n print(memo.index(min(memo)))\n', 'N, M = list(map(int, input().split()))\nSt = [input().split() for _ in range(N)]\nCh = [input().split() for _ in range(M)]\n\nfor i in range(N):\n memo = []\n for j in range(M):\n diff = abs(int(St[i][0]) - int(Ch[j][0])) + abs(int(St[i][1]) - int(Ch[j][1]))\n memo.append(diff)\n print(memo.index(min(memo)) + 1)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s423811267', 's998873693', 's354854965']
[3064.0, 3060.0, 3064.0]
[21.0, 21.0, 21.0]
[338, 324, 328]
p03774
u594956556
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\nstudent = [list(map(int, input().split())) for _ in range(N)]\ncp = [list(map(int, input().split())) for _ in range(M)]\n\nidou = []\nfor a, b in student:\n idousaki = -1\n nearest = 1000000000\n for i, x, y in enumerate(cp):\n d = abs(x-a) + abs(y-b)\n if d < nearest:\n nearest = d\n idousaki = i+1\n \n idou.append(idousaki)\n \nfor i in idou:\n print(i)\n', 'N, M = map(int, input().split())\nstudent = [list(map(int, input().split())) for _ in range(N)]\ncp = [list(map(int, input().split())) for _ in range(M)]\n\nidou = []\nfor a, b in student:\n idousaki = -1\n nearest = 1000000000\n for i, xy in enumerate(cp):\n d = abs(xy[0]-a) + abs(xy[1]-b)\n if d < nearest:\n nearest = d\n idousaki = i+1\n \n idou.append(idousaki)\n \nfor i in idou:\n print(i)\n']
['Runtime Error', 'Accepted']
['s790383939', 's770931546']
[3064.0, 3064.0]
[17.0, 19.0]
[402, 408]
p03774
u609814378
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['a', 'N, M = map(int, input().split())\n\nstudentlis = []\nfor _ in range(N):\n a, b = map(int, input().split())\n studentlis.append([a,b])\n\ncheckpointlis = []\nfor _ in range(M):\n c, d = map(int, input().split())\n checkpointlis.append([c,d])\n\nans_lis = []\n\n\nfor i in range(len(studentlis)):\n ans = int(10**100)\n\n tmpstudentlis = studentlis[i]\n\n x1 = tmpstudentlis[0]\n y1 = tmpstudentlis[1]\n \n for j in range(len(checkpointlis)):\n tmpcheckpointlis = checkpointlis[j]\n\n x2 = tmpcheckpointlis[0]\n y2 = tmpcheckpointlis[1]\n \n distance = (abs(x1-x2) + abs(y1-y2))\n\n if distance < ans:\n ans = distance\n num = j\n\n if j == len(checkpointlis)-1:\n ans_lis.append(num+1)\n\n\nfor i in ans_lis:\n print(i)']
['Runtime Error', 'Accepted']
['s781728335', 's234380477']
[2940.0, 3064.0]
[17.0, 19.0]
[1, 793]
p03774
u623687794
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\nstudents=[]\nchecks=[]\ndef mdistance([a,b],[c,d]):\n return abs(a-c)+abs(b-d)\nfor i in range(n):\n a=list(map(int,input().split()))\n students.append(a)\nfor i in range(m):\n checks.append(list(map(int,input().split())))\nfor i in range(n):\n anspoint=0\n for j in range(m):\n if mdistance(students[i],checks[j])<mdistance(students[i],checks[anspoint]):\n anspoint=j\n print(j)', 'n,m=map(int,input().split())\ns=[]\nc=[]\ndef mdistance(a,b,c,d):\n return abs(a-c)+abs(b-d)\nfor i in range(n):\n a=list(map(int,input().split()))\n s.append(a)\nfor i in range(m):\n c.append(list(map(int,input().split())))\nfor i in range(n):\n anspoint=0\n for j in range(m):\n if mdistance(s[i][0],s[i][1],c[j][0],c[j][1])<mdistance(s[i][0],s[i][1],c[anspoint][0],c[anspoint][1]):\n anspoint=j\n print(anspoint+1)\n\n']
['Runtime Error', 'Accepted']
['s887927280', 's426665767']
[2940.0, 3064.0]
[17.0, 20.0]
[409, 419]
p03774
u623814058
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\nx = [list(map(int, input().split())) for _ in range(N)]\ny = [list(map(int, input().split())) for _ in range(M)]\nfor a,b in ab:\n z = [abs(a-c) + abs(b-d) for c,d in cd]\n print(z.index(min(z))+1)', 'N = int(input())\n\ny = []\n\nfor i in range(1, N//2):\n if N % i == 0:\n y.append( max( len(str(i)), len(str(int(N/i))) ) )\nprint(min(y))', 'N, M = map(int, input().split())\nx = [list(map(int, input().split())) for _ in range(N)]\ny = [list(map(int, input().split())) for _ in range(M)]\nfor a,b in x:\n z = [abs(a-c) + abs(b-d) for c,d in y]\n print(z.index(min(z))+1)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s054509239', 's691553752', 's387749990']
[9064.0, 9068.0, 9072.0]
[25.0, 26.0, 28.0]
[232, 143, 230]
p03774
u664481257
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['# -*- coding: utf-8 -*-\n# !/usr/bin/env python\n# vim: set fileencoding=utf-8 :\n\n\nimport math\n\n\ndef calc_distance(student_post, checkpoint_post):\n return int(math.fabs(student_post[0] - checkpoint_post[0]) + math.fabs(student_post[1] - checkpoint_post[1]))\n\n\nif __name__ == \'__main__\':\n import doctest\n doctest.testmod()\n\n first = input()\n first = first.split(" ")\n data = [int(line) for line in first]\n\n student_num = data[0]\n checkpoint_num = data[1]\n\n student_pos_data = [[int(i) for i in input().split(" ")] for i in range(student_num)]\n checkpoint_data = [[int(i) for i in input().split(" ")] for i in range(checkpoint_num)]\n print(student_pos_data)\n print(checkpoint_data)\n\n for each_student in student_pos_data:\n dis_list = [calc_distance(each_student, i) for i in checkpoint_data]\n print(dis_list)\n print(dis_list.index(min(dis_list)) + 1)\n', '# -*- coding: utf-8 -*-\n# !/usr/bin/env python\n# vim: set fileencoding=utf-8 :\n\n\nimport math\n\n\ndef calc_distance(student_post, checkpoint_post):\n return int(math.fabs(student_post[0] - checkpoint_post[0]) + math.fabs(student_post[1] - checkpoint_post[1]))\n\n\nif __name__ == \'__main__\':\n import doctest\n doctest.testmod()\n\n first = input()\n first = first.split(" ")\n data = [int(line) for line in first]\n\n student_num = data[0]\n checkpoint_num = data[1]\n\n student_pos_data = [[int(i) for i in input().split(" ")] for i in range(student_num)]\n checkpoint_data = [[int(i) for i in input().split(" ")] for i in range(checkpoint_num)]\n\n for each_student in student_pos_data:\n dis_list = [calc_distance(each_student, i) for i in checkpoint_data]\n print(dis_list.index(min(dis_list)) + 1)\n']
['Wrong Answer', 'Accepted']
['s330441250', 's187271707']
[7048.0, 7048.0]
[61.0, 60.0]
[1047, 968]
p03774
u666964944
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m = map(int, input().split())\ns = [tuple(map(int,input().split())) for _ in range(n)]\nc = [tuple(map(int,input().split())) for _ in range(m)]\nfor i in range(n):\n mini = 0\n m_i = 0\n for j in range(m):\n dis = abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1])\n print(mini, dis)\n if j==0:\n mini, m_i = dis, j+1\n continue\n elif mini > dis:\n mini, m_i = dis, j+1\n print(m_i)', 'n,m = map(int, input().split())\ns = [tuple(map(int,input().split())) for _ in range(n)]\nc = [tuple(map(int,input().split())) for _ in range(m)]\nfor i in range(n):\n mini = 0\n m_i = 0\n for j in range(m):\n dis = abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1])\n if j==0:\n mini, m_i = dis, j+1\n continue\n elif mini > dis:\n mini, m_i = dis, j+1\n print(m_i)']
['Wrong Answer', 'Accepted']
['s733035932', 's325448397']
[9036.0, 9140.0]
[32.0, 32.0]
[393, 372]
p03774
u671252250
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['# coding: utf-8\n# Your code here!\n\nN, M = map(int, input().split())\nstd_li = [list(map(int, input().split())) for i in range(N)]\nchk_li = [list(map(int, input().split())) for j in range(M)]\ndist = 0\n\nfor i in range(N):\n ctr = 0\n min_dist = pow(10,8) * 4 + 1\n for j in range(M):\n dist = abs(std_li[i][0] - chk_li[j][0]) + abs(std_li[i][1] - chk_li[j][1])\n print(dist, min_dist)\n if dist < min_dist:\n min_dist = dist\n ctr = j + 1\n print(ctr)', '# coding: utf-8\n# Your code here!\n\nN, M = map(int, input().split())\nstd_li = [list(map(int, input().split())) for i in range(N)]\nchk_li = [list(map(int, input().split())) for j in range(M)]\ndist = 0\n\nfor i in range(N):\n ctr = 0\n min_dist = pow(10,8) * 4 + 1\n for j in range(M):\n dist = abs(std_li[i][0] - chk_li[j][0]) + abs(std_li[i][1] - chk_li[j][1])\n if dist < min_dist:\n min_dist = dist\n ctr = j + 1\n print(ctr)']
['Wrong Answer', 'Accepted']
['s704121078', 's624297333']
[3368.0, 3064.0]
[22.0, 19.0]
[494, 464]
p03774
u686036872
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\nprint(A)\nfor i in range(M):\n c, d = map(int, input().split())\n saitei = float("inf")\n for j in range(N):\n if abs(A[j][0]-c) + abs(A[j][1]-d) < saitei:\n saitei = abs(A[i][0]-c) + abs(A[i][1]-d)\n ans = j+1 \n else:\n continue\n print(ans) ', 'N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\n\nC=[]\nfor i in range(M):\n c, d = map(int, input().split())\n C.append([c, d])\n\nfor i in range(N):\n saitei = float("inf")\n ans = 0\n for j in range(M):\n if abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1]) < saitei:\n saitei = abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1])\n ans = j+1 \n print(ans) ', 'N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\n\nC=[]\nfor i in range(M):\n c, d = map(int, input().split())\n C.append([c, d])\n\nfor i in range(N):\n saitei = float("inf")\n ans = 0\n for j in range(M):\n if abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1]) < saitei:\n saitei = abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1])\n ans = j+1 \n else:\n continue\n print(ans) ', 'N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\n\nC=[]\nfor i in range(M):\n c, d = map(int, input().split())\n C.append([c, d])\n\nfor i in range(N):\n saitei = float("inf")\n ans = 0\n for j in range(M):\n if abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1]) < saitei:\n saitei = abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1])\n ans = j+1 \n print(ans) ', 'N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\n\nB=[]\nfor i in range(M):\n c, d = map(int, input().split())\n C.append([c, d])\n\nfor i in range(N):\n saitei = float("inf")\n ans = 0\n for j in range(M):\n if abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1]) < saitei:\n saitei = abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1])\n ans = j+1 \n print(ans) ', 'N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\n\nB=[]\nfor i in range(M):\n c, d = map(int, input().split())\n B.append([c, d])\n\nfor i in range(N):\n saitei = float("inf")\n ans = 0\n for j in range(M):\n if abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1]) < saitei:\n saitei = abs(A[i][0]-B[j][0]) + abs(A[i][1]-B[j][1])\n ans = j+1 \n print(ans) ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s297291448', 's380571887', 's711158937', 's765861334', 's960734424', 's522348474']
[3064.0, 2940.0, 2940.0, 3064.0, 3064.0, 3064.0]
[19.0, 25.0, 17.0, 17.0, 17.0, 19.0]
[413, 448, 483, 452, 452, 452]
p03774
u697696097
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['import sys\nfrom io import StringIO\nimport unittest\n\ndoTest=1\n\ndef yn(b):\n print("Yes" if b==1 else "No")\n return\n\ndef resolve():\n readline=sys.stdin.readline\n n,m=list(map(int, readline().strip().split()))\n a=[0]*n\n b=[0]*n\n c=[0]*m\n d=[0]*m\n\n for i in range(n):\n a[i],b[i]=list(map(int, readline().strip().split()))\n for i in range(m):\n c[i],d[i]=list(map(int, readline().strip().split()))\n\n for i in range(n):\n minDiff=999999999\n minpnt=9999999\n for j in range(m):\n diff=abs(a[i]-c[j])+abs(b[i]-d[j])\n if diff < minDiff:\n minDiff = diff\n minpnt=j\n print(minpnt+1)\n return\n\nif doTest==0:\n resolve()\n sys.exit()\n\n### ----------------\n\n### ----------------', 'import sys\nfrom io import StringIO\nimport unittest\n\ndoTest=0\n\ndef yn(b):\n print("Yes" if b==1 else "No")\n return\n\ndef resolve():\n readline=sys.stdin.readline\n n,m=list(map(int, readline().strip().split()))\n a=[0]*n\n b=[0]*n\n c=[0]*m\n d=[0]*m\n\n for i in range(n):\n a[i],b[i]=list(map(int, readline().strip().split()))\n for i in range(m):\n c[i],d[i]=list(map(int, readline().strip().split()))\n\n for i in range(n):\n minDiff=999999999\n minpnt=9999999\n for j in range(m):\n diff=abs(a[i]-c[j])+abs(b[i]-d[j])\n if diff < minDiff:\n minDiff = diff\n minpnt=j\n print(minpnt+1)\n return\n\nif doTest==0:\n resolve()\n sys.exit()\n\n### ----------------\n\n### ----------------']
['Wrong Answer', 'Accepted']
['s663219221', 's208041503']
[6244.0, 5616.0]
[69.0, 43.0]
[820, 820]
p03774
u699522269
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N,M = map(int,input().split())\nsts = [list(map(int, input().split())) for i in range(N)]\ncheckp = [[i+1]+list(map(int, input().split())) for i in range(M)]\nrt = [None] * N\ndistances = [2*(10**8)] * N\nfor s in range(N):\n for c in checkp:\n dist = abs(sts[s][0]-c[1]) + abs(sts[s][1]-c[2])\n if rt[s] is None:\n rt[s] = c[0]\n distances[s] = dist\n else:\n if distances[s] > dist:\n rt[s] = c[0]\n distances[s] = dist\nprint(rt)', 'N,M = map(int,input().split())\nsts = [list(map(int, input().split())) for i in range(N)]\ncheckp = [[i+1]+list(map(int, input().split())) for i in range(M)]\nrt = [None] * N\ndistances = [2*(10**8)] * N\nfor s in range(N):\n for c in checkp:\n dist = abs(sts[s][0]-c[1]) + abs(sts[s][1]-c[2])\n if rt[s] is None:\n rt[s] = c[0]\n distances[s] = dist\n else:\n if distances[s] > dist:\n rt[s] = c[0]\n distances[s] = dist\nfor i in rt:\n print(i)']
['Wrong Answer', 'Accepted']
['s939304748', 's117965410']
[9072.0, 9056.0]
[26.0, 31.0]
[456, 470]
p03774
u714300041
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['import numpy as np\n\nN, M = map(int, input().split())\nA = [map(int, input().split()) for _ in range(N)]\nB = [map(int, input().split()) for _ in range(M)]\n\nfor (x, y) in A:\n d = np.array([])\n for q in B:\n print("q = ", q)\n print("*q=", *q,)\n a, b = q\n d = np.append(d, abs(x-a) + abs(y-b))\n print(np.argmin(d) + 1)', 'import numpy as np\n\nN, M = map(int, input().split())\nA = [list(map(int, input().split())) for _ in range(N)]\nB = [list(map(int, input().split())) for _ in range(M)]\n\nfor (x, y) in A:\n d = np.array([])\n for (a, b) in B:\n d = np.append(d, abs(x-a) + abs(y-b))\n print(np.argmin(d) + 1)\n\n\n\n']
['Runtime Error', 'Accepted']
['s880178930', 's966211614']
[2940.0, 12424.0]
[17.0, 166.0]
[349, 302]
p03774
u733814820
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['from a import resolve\n\nimport sys\nfrom io import StringIO\nimport unittest\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n def test_入力例_1(self):\n input = """2 2\n2 0\n0 0\n-1 0\n1 0"""\n output = """2\n1"""\n self.assertIO(input, output)\n def test_入力例_2(self):\n input = """3 4\n10 10\n-10 -10\n3 3\n1 2\n2 3\n3 5\n3 5"""\n output = """3\n1\n2"""\n self.assertIO(input, output)\n def test_入力例_3(self):\n input = """5 5\n-100000000 -100000000\n-100000000 100000000\n100000000 -100000000\n100000000 100000000\n0 0\n0 0\n100000000 100000000\n100000000 -100000000\n-100000000 100000000\n-100000000 -100000000"""\n output = """5\n4\n3\n2\n1"""\n self.assertIO(input, output)\n\nif __name__ == "__main__":\n unittest.main()\n', 'def resolve():\n n, m = map(int, input().split())\n ab = []\n for i in range(n):\n ab.append(list(map(int, input().split())))\n cd = []\n for i in range(m):\n cd.append(list(map(int, input().split())))\n\n for a in ab:\n ans = 0\n dist = 10000000000\n for i in range(m):\n tmp = abs(a[0] - cd[i][0]) + abs(a[1] - cd[i][1])\n if tmp < dist:\n ans = i+1\n dist = tmp\n print(ans)\n return\n\nif __name__ == "__main__":\n resolve()\n']
['Runtime Error', 'Accepted']
['s605342644', 's638383513']
[3064.0, 3064.0]
[18.0, 18.0]
[1071, 458]
p03774
u735008991
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\nS = [list(input().split()) for _ in range(N)]\nC = [list(input().split()) for _ in range(M)]\nfor a, b in S:\n dist = [abs(a-c) + abs(b-d) for c, d in C]\n print(dist[dist.index(min(dist))])\n', 'N, M = map(int, input().split())\nS = [list(map(int, input().split())) for _ in range(N)]\nC = [list(map(int, input().split())) for _ in range(M)]\nfor a, b in S:\n dist = [abs(a-c) + abs(b-d) for c, d in C]\n print(dist.index(min(dist))+1)\n']
['Runtime Error', 'Accepted']
['s071481070', 's194425654']
[3060.0, 3060.0]
[17.0, 18.0]
[226, 242]
p03774
u750651325
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int,input().split())\n\nlist_a = []\nlist_b = []\ncount = 0\nans = [10**8 for i in range(N)]\n\nfor i in range(N):\n a = [int(i) for i in input().split()]\n list_a.append(a)\n \nfor i in range(M):\n b = [int(i) for i in input().split()]\n list_b.append(b)\n \nfor i in range(N):\n ans_x = 10**8\n for j in range(M):\n x = abs(list_a[i][0]-list_b[j][0])\n y = abs(list_a[i][1]-list_b[j][1])\n xxx = x + y\n if xxx < ans_x:\n ans_x = xxx\n count = j+1\n ans[i] = min(count, ans[i])\n print(ans[i])\n\n\n ', 'N, M = map(int,input().split())\n\nlist_a = []\nlist_b = []\ncount = 0\n\nfor i in range(N):\n a = [int(i) for i in input().split()]\n list_a.append(a)\n \nfor i in range(M):\n b = [int(i) for i in input().split()]\n list_b.append(b)\n \nfor i in range(N):\n ans_x = 10**18\n for j in range(M):\n x = abs(list_a[i][0]-list_b[j][0])\n y = abs(list_a[i][1]-list_b[j][1])\n xxx = x + y\n if xxx < ans_x:\n ans_x = xxx\n count = j+1\n print(count)\n\n\n ']
['Wrong Answer', 'Accepted']
['s990145586', 's844978819']
[3064.0, 3064.0]
[19.0, 19.0]
[576, 504]
p03774
u762603420
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = list(map(int, input().split()))\n\na = []\nc = []\nfor i in range(0, N + M):\n s = list(map(int, input().split()))\n if i < N:\n a.append(s)\n else:\n c.append(s)\n\nprint (a)\nprint (c)\n\nfor i in range(0, N):\n min_idx = 0\n min_dis = 999999999999\n for j in range(0, M):\n dis = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])\n if min_dis > dis:\n min_dis = dis\n min_idx = j + 1\n print(str(min_idx))', 'N, M = list(map(int, input().split()))\n\na = []\nc = []\nfor i in range(0, N + M):\n s = list(map(int, input().split()))\n if i < N:\n a.append(s)\n else:\n c.append(s)\n\nfor i in range(0, N):\n min_idx = 0\n min_dis = 999999999999\n for j in range(0, M):\n dis = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])\n if min_dis > dis:\n min_dis = dis\n min_idx = j + 1\n print(str(min_idx))']
['Wrong Answer', 'Accepted']
['s434171277', 's207094061']
[3064.0, 3064.0]
[18.0, 19.0]
[463, 442]
p03774
u767664985
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\na, b, c, d = [0] * N, [0] * N, [0] * M, [0] * M\nfor i in range(N):\n\ta[i], b[i] = map(int, input().split())\nfor i in range(M):\n\tc[i], d[i] = map(int, input().split())\n\nfor j in range(N):\n\tfor k in range(M - 1, -1, -1):\n\t\tans = "nan"\n\t\tdiff = float("inf")\n\t\tif abs(a[j] - c[k]) + abs(b[j] - d[k]) < diff:\n\t\t\tdiff = abs(a[j] - c[k]) + abs(b[j] - d[k])\n\t\t\tans = k\n\tprint(k + 1)\n', 'N, M = map(int, input().split())\na, b, c, d = [0] * N, [0] * N, [0] * M, [0] * M\nfor i in range(N):\n\ta[i], b[i] = map(int, input().split())\nfor i in range(M):\n\tc[i], d[i] = map(int, input().split())\n\nfor j in range(N):\n\tans = "nan"\n\tdiff = float("inf")\n\tfor k in range(M):\n\t\tif abs(a[j] - c[k]) + abs(b[j] - d[k]) < diff:\n\t\t\tdiff = abs(a[j] - c[k]) + abs(b[j] - d[k])\n\t\t\tans = k\n\tprint(ans + 1)\n']
['Wrong Answer', 'Accepted']
['s080420760', 's191051840']
[3064.0, 3064.0]
[21.0, 19.0]
[407, 395]
p03774
u782654209
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
["N,M=map(int,input().split(' '))\nS = [list(map(int,input().split(' '))) for i in range(N)]\nC = [list(map(int,input().split(' '))) for i in range(M)]\nfor i in range(N):\n l = [abs(S[i][0]-C[i][0])+abs(S[i][1]-C[i][1]) for i in range(M)]\n print(l.index(min(l))+1)", "N,M=map(int,input().split(' '))\nS = [list(map(int,input().split(' '))) for i in range(N)]\nC = [list(map(int,input().split(' '))) for i in range(M)]\nfor i in range(N):\n l = [abs(S[i][0]-C[j][0])+abs(S[i][1]-C[j][1]) for j in range(M)]\n print(l.index(min(l))+1)\n"]
['Runtime Error', 'Accepted']
['s650116479', 's792762222']
[3064.0, 3064.0]
[19.0, 19.0]
[261, 262]
p03774
u784022244
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N,M=map(int, input().split())\nS=[]\nfor i in range(N):\n a,b=map(int, input().split())\n S.append((a,b))\n\nC=[]\nfor i in range(M):\n c,d=map(int, input().split())\n C.append((c,d,i+1))\nprint(C)\nfor s in S:\n a,b=s\n now=0\n dis=10**9\n\n for t in C:\n c,d,n=t\n D=abs(c-a)+abs(d-b)\n \n if D<dis:\n dis=D\n now=n\n print(now)', 'N,M=map(int, input().split())\nS=[]\nfor i in range(N):\n a,b=map(int, input().split())\n S.append((a,b))\n\nC=[]\nfor i in range(M):\n c,d=map(int, input().split())\n C.append((c,d,i+1))\n#print(C)\nfor s in S:\n a,b=s\n now=0\n dis=10**9\n\n for t in C:\n c,d,n=t\n D=abs(c-a)+abs(d-b)\n \n if D<dis:\n dis=D\n now=n\n print(now)']
['Wrong Answer', 'Accepted']
['s864075638', 's121271513']
[3064.0, 3064.0]
[18.0, 19.0]
[384, 385]
p03774
u785578220
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['a,b = map(int, input().split())\nx = []\nz = []\nm =19999999999999\ns = 1\nfor i in range(a):\n ta , tb = map(int, input().split()) \n x.append([ta,tb])\nfor i in range(a):\n ta , tb = map(int, input().split())\n z.append([ta,tb])\nfor ta , tb in x:\n s = 0\n m =19999999999999\n for n,(s,y) in enumerate(z):\n print(n,s,y)\n \n if m >= abs(s-ta)+abs(y-tb):\n m = abs(s-ta)+abs(y-tb)\n s = n\n print(s+1)', "n,m=map(int,input().split())\np=[list(map(int,input().split()))for _ in range(n)]\ns=[list(map(int,'0'*m))for _ in range(n)]\nfor j in range(m):\n c,d=map(int,input().split())\n for i in range(n):\n s[i][j]=abs(p[i][0]-c)+abs(p[i][1]-d)\nelse:\n for i in range(n):print(1+s[i].index(min(s[i])))\n"]
['Runtime Error', 'Accepted']
['s839889610', 's416222838']
[3264.0, 3064.0]
[23.0, 19.0]
[484, 293]
p03774
u790048565
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\nAB = []\nfor _ in range(N):\n a, b = map(int, input().split())\n AB.append((a, b))\n\nCD = []\nfor _ in range(M):\n c, d = map(int, input().split())\n CD.append((c, d))\n\ncheck_index = []\nfor i, ab in enumerate(AB):\n min_index = 0\n for j, cd in enumerate(CD):\n check_dis = distance(ab, cd)\n min_dis = distance(ab, CD[min_index])\n if(min_dis > check_dis):\n min_index = j\n \n check_index.append(min_index)\n\nfor ci in check_index:\n print(ci + 1)\n', 'def distance(ab, cd):\n return abs(ab[0] - cd[0]) + abs(ab[1] - cd[1])\n\nN, M = map(int, input().split())\nAB = []\nfor _ in range(N):\n a, b = map(int, input().split())\n AB.append((a, b))\n\nCD = []\nfor _ in range(M):\n c, d = map(int, input().split())\n CD.append((c, d))\n\ncheck_index = []\nfor i, ab in enumerate(AB):\n min_index = 0\n for j, cd in enumerate(CD):\n check_dis = distance(ab, cd)\n min_dis = distance(ab, CD[min_index])\n if(min_dis > check_dis):\n min_index = j\n \n check_index.append(min_index)\n\nfor ci in check_index:\n print(ci + 1)']
['Runtime Error', 'Accepted']
['s367134879', 's396748230']
[3064.0, 3064.0]
[22.0, 19.0]
[489, 560]
p03774
u803848678
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = list(map(int, input().split()))\na = []\nb = []\nc = []\nd = []\nfor i in range(N):\n aa, bb = list(map(int, input().split()))\n a.append(aa)\n b.append(bb)\n\nfor i in range(M):\n cc, dd = list(map(int, input().split()))\n c.append(cc)\n d.append(dd)\n\nans = []\nfor i in range(N):\n x = a[i]\n y = b[i]\n ind = 0\n distance = 100000\n for j in range(M):\n if(distance > abs(x - c[j]) + abs(y - d[j])):\n ind = j\n distance = abs(x - c[j]) + abs(y - d[j])\n ans.append(ind)\n\nfor i in range(N):\n print(ans[i])\n', 'N, M = list(map(int, input().split()))\na = []\nb = []\nc = []\nd = []\nfor i in range(N):\n aa, bb = list(map(int, input().split()))\n a.append(aa)\n b.append(bb)\n\nfor i in range(M):\n cc, dd = list(map(int, input().split()))\n c.append(cc)\n d.append(dd)\n\nans = []\nfor i in range(N):\n x = a[i]\n y = b[i]\n ind = 0\n distance = 4*10**8\n for j in range(M):\n if(distance > abs(x - c[j]) + abs(y - d[j])):\n ind = j\n distance = abs(x - c[j]) + abs(y - d[j])\n ans.append(ind)\n\nfor i in range(N):\n print(ans[i] + 1)\n']
['Wrong Answer', 'Accepted']
['s665461145', 's265634774']
[3064.0, 3064.0]
[18.0, 18.0]
[561, 566]
p03774
u816645498
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['#include<bits/stdc++.h>\nusing namespace std;\nusing ll = long long;\n\nint main()\n{\n int N, M;\n scanf("%d %d", &N, &M);\n int a[N], b[N];\n REP(i, N) scanf("%d %d", &a[i], &b[i]);\n int c[M], d[M];\n REP(i, M) scanf("%d %d", &c[i], &d[i]);\n REP(i, N) {\n int res = -1;\n int dis = 1e9;\n REP(j, M) {\n int tmp = abs(c[j] - a[i]) + abs(d[j] - b[i]);\n if(tmp < dis) dis = tmp, res = j + 1;\n }\n printf("%d\\n", res);\n }\n return 0;\n}', "#!/usr/bin/python3\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\n\ndef main():\n n, m = map(int, input().split())\n ab = [list(map(int, input().split())) for _ in range(n)]\n cd = [list(map(int, input().split())) for _ in range(m)]\n\n for a, b in ab:\n arr = []\n for c, d in cd:\n arr.append(abs(a-c) + abs(b-d))\n print(arr.index(min(arr)) + 1)\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Accepted']
['s674656132', 's749304165']
[2940.0, 3064.0]
[18.0, 18.0]
[550, 442]
p03774
u844005364
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n, m = map(int, input().split())\n\nstudents = [list(map(int, input().split())) for _ in range(n)]\ncheckpoints = [list(map(int, input().split())) for _ in range(m)]\n\nfor a, b in students:\n min_distance = float("inf")\n min_checkpoint = 0\n for i, cd in enumerate(checkpoints):\n c, d = cd\n if abs(c - a) + abs(d - b) < min_distance:\n min_checkpoint = i + 1\n print(min_checkpoint)', 'n, m = map(int, input().split())\n\nabs = [list(map(int, input().split())) for _ in range(n)]\ncds = [list(map(int, input().split())) for _ in range(m)]\n\nfor a, b in abs:\n min_distance = float("inf")\n min_checkpoint = 0\n for i, cd in enumerate(cds):\n c, d = cd\n if abs(c - a) + abs(d - b) < min_checkpoint:\n min_checkpoint = i + 1\n print(min_checkpoint)', 'n, m = map(int, input().split())\n\nstudents = [list(map(int, input().split())) for _ in range(n)]\ncheckpoints = [list(map(int, input().split())) for _ in range(m)]\n\nfor a, b in students:\n min_distance = float("inf")\n min_checkpoint = 0\n for i, cd in enumerate(checkpoints):\n c, d = cd\n if abs(c - a) + abs(d - b) < min_distance:\n min_checkpoint = i + 1\n min_distance = abs(c - a) + abs(d - b)\n print(min_checkpoint)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s101986529', 's663044339', 's067421082']
[3064.0, 3064.0, 3064.0]
[19.0, 17.0, 18.0]
[411, 365, 462]
p03774
u846226907
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N,M = map(int,input().split())\n\na = [0]*N\nb = [0]*N\n\nfor i in range(N):\n a[i],b[i] = map(int,input().split())\n\nx = [0]*M\ny = [0]*M\n\nfor i in range(M):\n x[i],y[i]= map(int,input().split())\n\nfor i in range(N):\n dis = 10000000000000000\n for j in range(M):\n dis = min(dis,(abs(a[i]-x[j])+abs(b[i]-y[j])))\n res = i\n\n print(res+1)\n', 'N,M = map(int,input().split())\n\na = [0]*N\nb = [0]*N\n\nfor i in range(N):\n a[i],b[i] = map(int,input().split())\n\nx = [0]*M\ny = [0]*M\n\nfor i in range(M):\n x[i],y[i]= map(int,input().split())\n\nfor i in range(N):\n dis = 10000000000000000\n res = 0\n for j in range(M):\n if dis > (abs(a[i]-x[j])+abs(b[i]-y[j])):\n dis = min(dis,(abs(a[i]-x[j])+abs(b[i]-y[j])))\n res = j\n\n print(res+1)\n']
['Wrong Answer', 'Accepted']
['s082266623', 's392548084']
[3064.0, 3064.0]
[19.0, 19.0]
[355, 425]
p03774
u852790844
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['import numpy as np\nfrom scipy.spatial.distance import minkowski\n\nn, m = map(int, input().split())\na = np.array([list(map(int, input().split())) for i in range(n)])\nfor i in range(m):\n b = np.array(list(map(int,input())))\n c = np.array([minkowski(i, b , 1) for i in a], dtype=np.int64)\n ans = np.argmin(c) + 1\n print(ans)', 'import numpy as np\nfrom scipy.spatial.distance import minkowski\n\nn, m = map(int, input().split())\na = np.array([list(map(int, input().split())) for i in range(n)])\nb = np.array([list(map(int, input().split())) for i in range(m)])\n\nfor i in range(n):\n c = np.array([minkowski(a[i], j , 1) for j in b], dtype=np.int64)\n ans = np.argmin(c) + 1\n print(ans)']
['Runtime Error', 'Accepted']
['s684236796', 's539041173']
[14896.0, 19368.0]
[182.0, 289.0]
[332, 361]
p03774
u853900545
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m = map(int,input().split())\na = [0]*n\nb = [0]*n\nc = [0]*m\nd = [0]*m\n\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\nfor i in range(m):\n c[i],d[i] = map(int,input().split())\n \nD = [[0]*m]*n\nfor i in range(n):\n for j in range(m):\n D[i][j] = abs(a[i]-b[i])+abs(c[i]-d[i])\n\nfor i in range(n):\n print(D[i].index(min(D[i]))+1)', 'n,m = map(int,input().split())\na,b = [[] for i in range(n)],[[] for i in range(n)]\nc,d = [[] for i in range(m)],[[] for i in range(m)]\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\nfor i in range(m):\n c[i],d[i] = map(int,input().split())\n\ncheck = [[] for i in range(m)]\nfor i in range(n):\n for j in range(m):\n check[j] = abs(a[i]-c[j])+abs(b[i]-d[j])\n print(min(check))', 'n,m = map(int,input().split())\na = [0]*n\nb = [0]*n\nc = [0]*m\nd = [0]*m\n\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\nfor i in range(m):\n c[i],d[i] = map(int,input().split())\n \nD = [[0]*m]*n\nfor i in range(n):\n for j in range(m):\n D[i][j] = abs(a[i]-c[j])+abs(b[i]-d[j])\n\nfor i in range(n):\n print(D[i].index(min(D[i]))+1)', 'n,m = map(int,input().split())\na,b = [[] for i in range(n)],[[] for i in range(n)]\nc,d = [[] for i in range(m)],[[] for i in range(m)]\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\nfor i in range(m):\n c[i],d[i] = map(int,input().split())\n\ncheck = [[] for i in range(m)]\nfor i in range(n):\n for j in range(m):\n check[j] = abs(a[i]-c[j])+abs(b[i]-d[j])\n print(check.index(min(check)))', 'n,m = map(int,input().split())\na = [0]*n\nb = [0]*n\nc = [0]*m\nd = [0]*m\n\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\nfor i in range(m):\n c[i],d[i] = map(int,input().split())\n \nD = [[0]*m]*n\nfor i in range(n):\n for j in range(m):\n D[i][j] = abs(a[i]-c[i])+abs(b[i]-d[i])\n\nfor i in range(n):\n print(D[i].index(min(D[i]))+1)', 'n,m = map(int,input().split())\na,b = [[] for i in range(n)],[[] for i in range(n)]\nc,d = [[] for i in range(m)],[[] for i in range(m)]\nfor i in range(n):\n a[i],b[i] = map(int,input().split())\nfor i in range(m):\n c[i],d[i] = map(int,input().split())\n\ncheck = [[] for i in range(m)]\nfor i in range(n):\n for j in range(m):\n check[j] = abs(a[i]-c[j])+abs(b[i]-d[j])\n print(check.index(min(check))+1)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s329544098', 's618663817', 's699632828', 's724294525', 's914072623', 's002797086']
[3064.0, 3192.0, 3064.0, 3064.0, 3064.0, 3188.0]
[18.0, 20.0, 19.0, 19.0, 18.0, 21.0]
[355, 399, 355, 412, 355, 414]
p03774
u856169020
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['N, M = map(int, input().split())\nstu = []\nfor _ in range(N):\n stu.append(tuple(map(int, input().split())))\nche = []\nfor _ in range(M):\n che.append(tuple(map(int, input().split())))\n\nfor i in range(N):\n ans = 0\n min_l = pow(10, 10)\n for j in range(M):\n l = abs(stu[i][0] - che[i][0]) + abs(stu[i][1] - che[i][1])\n if l < min_l:\n min_l = l\n ans = j+1\n print(ans)', 'N, M = map(int, input().split())\nstu = []\nfor _ in range(N):\n stu.append(tuple(map(int, input().split())))\nche = []\nfor _ in range(M):\n che.append(tuple(map(int, input().split())))\n\nfor i in range(N):\n ans = 0\n min_l = pow(10, 10)\n for j in range(M):\n l = abs(stu[i][0] - che[j][0]) + abs(stu[i][1] - che[j][1])\n if l < min_l:\n min_l = l\n ans = j+1\n print(ans)']
['Runtime Error', 'Accepted']
['s170905873', 's603076726']
[3064.0, 3064.0]
[18.0, 18.0]
[382, 382]
p03774
u859897687
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\na=[list(map(int,input().split()))for i in range(n)]\nb=[list(map(int,input().split()))for i in range(m)]\nfor i in a:\n ans=10**18\n for j in b:\n ans=min(ans,abs(i[0]-j[0])+abs(i[1]-j[1]))', 'n,m=map(int,input().split())\na=[list(map(int,input().split()))for i in range(n)]\nb=[list(map(int,input().split()))for i in range(m)]\nfor i in a:\n ans=10**18\n for j in b:\n ans=min(ans,abs(i[0]-j[0])+abs(i[1]-j[1]))\n print(ans)', 'n,m=map(int,input().split())\na=[list(map(int,input().split()))for i in range(n)]\nb=[list(map(int,input().split()))for i in range(m)]\nfor i in a:\n t=10**18\n ans=0\n c=1\n for j in b:\n k=abs(i[0]-j[0])+abs(i[1]-j[1])\n if t>k:\n ans=c\n t=k\n c+=1\n print(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s031170659', 's838443283', 's880338752']
[3060.0, 3060.0, 3064.0]
[19.0, 19.0, 19.0]
[218, 231, 275]
p03774
u878138257
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m = map(int,input().split())\nlistA = [list(map(int, list(input()))) for i in range(n)]\nlistB = [list(map(int, list(input()))) for j in range(m)]\nlistC=[]\nfor k in range(n):\n for l in range(m):\n listC.append(abs(listA[k][0]-listB[l][0])+abs(list[k][1]-listB[l][1]))\n listC.sort()\n print(listC[0])\n', 'n,m = map(int,input().split())\nlistA = [list(map(int, input().split())) for i in range(n)]\nlistB = [list(map(int, input().split())) for j in range(m)]\nlistC=[]\n\nfor k in range(n):\n b=0\n c=0\n for l in range(m):\n a=abs(listA[k][0]-listB[l][0])+abs(listA[k][1]-listB[l][1])\n if a<b or l==0:\n b=a\n c=l\n print(c+1)']
['Runtime Error', 'Accepted']
['s659268924', 's133643160']
[3064.0, 3064.0]
[17.0, 20.0]
[304, 329]
p03774
u900303768
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n, m = map(int,input().split())\n\nla = []\nfor i in range(n):\n a, b = map(int, input().split())\n la.append((a,b))\n\nca = []\nfor i in la:\n a, b = map(int, input().split())\n ca.append((a,b))\n\nfor i in ca:\n mi = 1000000001\n ans = 0\n for j in range(len(ca)):\n if abs(i[0]-ca[j][0]) + abs(i[1]-ca[j][1]) < mi:\n mi = abs(i[0]-ca[j][0]) + abs(i[1]-ca[j][1])\n ans = j+1\n print(ans)\n\n', 'n, m = map(int,input().split())\n\nla = []\nfor i in range(n):\n a, b = map(int, input().split())\n la.append((a,b))\n\nca = []\nfor i in range(m):\n a, b = map(int, input().split())\n ca.append((a,b))\n\nfor i in range(len(la)):\n mi = 1000000001\n ans = 0\n for j in range(len(ca)):\n p = abs(la[i][0]-ca[j][0]) + abs(la[i][1]-ca[j][1])\n if p < mi:\n mi = p\n ans = j+1\n print(ans)\n\n']
['Runtime Error', 'Accepted']
['s436052783', 's784137644']
[3064.0, 3064.0]
[19.0, 21.0]
[425, 428]
p03774
u905582793
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\nstd = [list(map(int,input().split())) for i in range(n)]\nchk = [list(map(int,input().split())) for i in range(m)]\nfor s in std:\n print(min(lambda i:abs(s[0]-chk[i][0])+abs(s[1]-chk[i][1])))', 'n,m=map(int,input().split())\nstd = [list(map(int,input().split())) for i in range(n)]\nchk = [list(map(int,input().split())) for i in range(m)]\nfor s in std:\n ans=[]\n for i in range(m):\n ans.append([abs(s[0]-chk[i][0])+abs(s[1]-chk[i][1]),i+1])\n ans.sort()\n print(ans[0][1])']
['Runtime Error', 'Accepted']
['s650006126', 's388170284']
[3060.0, 3064.0]
[17.0, 22.0]
[219, 282]
p03774
u922449550
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
["N, M = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(N)]\ncd = [list(map(int, input().split())) for i in range(M)]\n\nans = []\nfor i, (a, b) in enumerate(ab):\n min_dist = 10**20\n idx = -1\n for j, (c, d) in enumerate(cd):\n dij = abs(a - c) + abs(b - d)\n if dij < min_dist:\n min_dist = dij\n idx = j\n ans.append(idx)\n\nprint(*ans, sep='\\n')", "N, M = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(N)]\ncd = [list(map(int, input().split())) for i in range(M)]\n\nans = []\nfor i, (a, b) in enumerate(ab):\n min_dist = 10**20\n idx = -1\n for j, (c, d) in enumerate(cd):\n dij = abs(a - c) + abs(b - d)\n if dij < min_dist:\n min_dist = dij\n idx = j\n ans.append(idx+1)\n\nprint(*ans, sep='\\n')"]
['Wrong Answer', 'Accepted']
['s494347165', 's583112071']
[3064.0, 3064.0]
[19.0, 18.0]
[386, 388]
p03774
u939822134
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['import sys\nimport numpy as np\n\nN, M = (int(i) for i in input().split(" "))\nS = [input().split(" ") for i in range(N + M)]\n\nseito = S[0:N]\ncheck = S[N:N+M]\n\nkyori = np.zeros(M)\n\nfor j in range(0,N):\n\tfor i in range(0,M):\n\t\tkyori[i] = abs(int(seito[j][0]) - int(check[i][0])) + abs(int(seito[j][1]) - int(check[i][1]))\n\t\n\n\tnum = np.argmin(kyori)\n\tprint(num)\n\n\n\n', 'import sys\nimport numpy as np\n\nN, M = (int(i) for i in input().split(" "))\nS = [input().split(" ") for i in range(N + M)]\n\nseito = S[0:N]\ncheck = S[N:N+M]\n\nkyori = np.zeros(M)\n\nfor j in range(0,N):\n\tfor i in range(0,M):\n\t\tkyori[i] = abs(int(seito[j][0]) - int(check[i][0])) + abs(int(seito[j][1]) - int(check[i][1]))\n\t\n\n\tnum = np.argmin(kyori) + 1\n\tprint(num)\n\n\n\n']
['Wrong Answer', 'Accepted']
['s701800436', 's446208364']
[12496.0, 12492.0]
[150.0, 154.0]
[396, 400]
p03774
u945418216
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
["n,m = map(int, input().split())\naa = [0] * m\nbb = [0] * m\ncc = [0] * m\ndd = [0] * m\n\nfor i in range(n):\n aa[i], bb[i] = map(int, input().split())\nfor i in range(m):\n cc[i], dd[i] = map(int, input().split())\n\ndistance = []\nfor i in range(n):\n d = []\n for j in range(m):\n d_ = abs(aa[i] - cc[j]) + abs(bb[i] - dd[j])\n d.append(d_)\n print('({}, {}) ({}, {}) :{}'.format(aa[i],bb[i],cc[j],dd[j], d_))\n distance.append(d)\nfor d in distance:\n print(d.index(min(d))+1)", 'n,m = map(int, input().split())\naa = [0] * n\nbb = [0] * n\ncc = [0] * m\ndd = [0] * m\n\nfor i in range(n):\n aa[i], bb[i] = map(int, input().split())\nfor i in range(m):\n cc[i], dd[i] = map(int, input().split())\n\nfor i in range(n):\n d = [abs(aa[i] - cc[j]) + abs(bb[i] - dd[j]) for j in range(m)]\n print(d.index(min(d))+1)']
['Runtime Error', 'Accepted']
['s309855670', 's333408355']
[3316.0, 3064.0]
[24.0, 18.0]
[501, 329]
p03774
u957957759
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\na=[]\nb=[]\nc=[]\nd=[]\nx=[]\ny=[]\nl=[]\np=[]\nfor i in range(n):\n ai,bi=map(int,input().split())\n a.append(ai)\n b.append(bi)\nfor j in range(m):\n ci,di=map(int,input().split())\n c.append(ci)\n d.append(di)\n \nfor i in range(n):\n for j in range(m):\n x.append(abs(a[i]-c[j]))\n y.append(abs(b[i]-d[j]))\n l.append(x[i]+y[i])\n p.append(l.index(min(l)))\n l=[]\n \nfor i in range(n):\n print(p[i])', 'n,m=map(int,input().split())\na=[]\nb=[]\nc=[]\nd=[]\nx=[]\ny=[]\nl=[]\np=[]\nfor i in range(n):\n ai,bi=map(int,input().split())\n a.append(ai)\n b.append(bi)\nfor j in range(m):\n ci,di=map(int,input().split())\n c.append(ci)\n d.append(di)\n \nfor i in range(n):\n for j in range(m):\n x.append(abs(a[i]-c[j]))\n y.append(abs(b[i]-d[j]))\n l.append(x[i]+y[i])\n \n p.append(l.index(min(l))+1) \n l=[]\n \nfor i in range(n):\n print(p[i])', 'n,m=map(int,input().split())\na=[]\nb=[]\nc=[]\nd=[]\nx=[]\ny=[]\nl=[]\np=[]\n\nfor i in range(n):\n ai,bi=map(int,input().split())\n a.append(ai)\n b.append(bi)\n \nfor j in range(m):\n ci,di=map(int,input().split())\n c.append(ci)\n d.append(di)\n \nfor i in range(n):\n for j in range(m):\n x.append(abs(a[i]-c[j]))\n y.append(abs(b[i]-d[j]))\n l.append(x[i]+y[i])\n \n p.append(l.index(min(l))+1) \n l=[]\n x=[]\n y=[]\n \nfor i in range(n):\n print(p[i])', 'n,m=map(int,input().split())\na=[]\nb=[]\nc=[]\nd=[]\nx=[]\ny=[]\nl=[]\np=[]\nfor i in range(n):\n ai,bi=map(int,input().split())\n a.append(ai)\n b.append(bi)\nfor j in range(m):\n ci,di=map(int,input().split())\n c.append(ci)\n d.append(di)\n \nfor i in range(n):\n for j in range(m):\n x.append(abs(a[i]-c[j]))\n y.append(abs(b[i]-d[j]))\n l.append(x[i]+y[i])\n p.append(l.index(min(l))+1)\n \n l=[]\n \nfor i in range(n):\n print(p[i])', 'n,m=map(int,input().split())\na=[]\nb=[]\nc=[]\nd=[]\nx=[]\ny=[]\nl=[]\np=[]\n\nfor i in range(n):\n ai,bi=map(int,input().split())\n a.append(ai)\n b.append(bi)\n \nfor j in range(m):\n ci,di=map(int,input().split())\n c.append(ci)\n d.append(di)\n \nfor i in range(n):\n for j in range(m):\n x.append(abs(a[i]-c[j]))\n y.append(abs(b[i]-d[j]))\n l.append(x[j+i*m]+y[j+i*m])\n \n p.append(l.index(min(l))+1) \n l=[]\n #x=[]\n #y=[]\n \nfor i in range(n):\n print(p[i])']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s024932725', 's163576491', 's492049495', 's912990549', 's628029645']
[3188.0, 3188.0, 3064.0, 3188.0, 3188.0]
[20.0, 19.0, 18.0, 22.0, 20.0]
[476, 478, 498, 483, 508]
p03774
u970197315
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['# ABC057 B - Checkpoints\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\nn,m = nm()\n\nAB = []\nCD = []\nans = 10**10\nfor i in range(n):\n a,b = nm()\n AB.append(a)\n AB.append(b)\n\nfor i in range(m):\n c,d = nm()\n CD.append(c)\n CD.append(d)\n\nfor i in range(n):\n for j in range(m):\n ans = min(ans,abs(AB[0]-CD[0])+abs(AB[1]-CD[1]))\n print(ans)', "import sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\nab = []\ncd = []\nfor _ in range(n):\n a, b = map(int, input().split())\n ab.append((a, b))\nfor _ in range(m):\n c, d = map(int, input().split())\n cd.append((c, d))\nans = []\nfor a, b in ab:\n t = 10**18\n checkpoint = -1\n for i, cdi in enumerate(cd):\n c, d = cdi\n dist = abs(a-c)+abs(b-d)\n if dist < t:\n t = dist\n checkpoint = (i+1)\n ans.append(checkpoint)\nprint(*ans, sep='\\n')\n"]
['Wrong Answer', 'Accepted']
['s333040100', 's119239477']
[3064.0, 8984.0]
[18.0, 29.0]
[448, 511]
p03774
u970198631
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['MM = input().split()\nN = int(MM[0])\nM = int(MM[1])\nlist1 = []\nlist2 = []\nfor i in range(N):\n LL = input().split()\n list1.append(LL)\nprint(list1)\nfor i in range(M):\n MM = input().split()\n list2.append(MM)\nprint(list2)\nfor i in list1:\n mini = 40**8\n ans = 0\n for j in range(len(list2)):\n x = int(i[0]) - int(list2[j][0])\n y = int(i[1]) - int(list2[j][1])\n xx = abs(x) + abs(y)\n if xx < mini:\n mini = xx\n ans = j+1\n print(ans)\n ', 'MM = input().split()\nN = int(MM[0])\nM = int(MM[1])\nlist1 = []\nlist2 = []\nfor i in range(N):\n LL = input().split()\n list1.append(LL)\n\nfor i in range(M):\n MM = input().split()\n list2.append(MM)\n\nfor i in list1:\n mini = 40**8\n ans = 0\n for j in range(len(list2)):\n x = int(i[0]) - int(list2[j][0])\n y = int(i[1]) - int(list2[j][1])\n xx = abs(x) + abs(y)\n if xx < mini:\n mini = xx\n ans = j+1\n print(ans)']
['Wrong Answer', 'Accepted']
['s967651427', 's628382831']
[9184.0, 8984.0]
[29.0, 28.0]
[460, 429]
p03774
u977389981
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n, m = map(int, input().split())\nAB = [[int(i) for i in input().split()] for i in range(n)]\nCD = [[int(i) for i in input().split()] for i in range(m)]\n\nfor a, b in AB:\n dist = 10 ** 12\n for i, cd in enumerate(CD):\n tmp = abs(a - cd[0]) + abs(b - cd[1])\n if tmp < dist:\n dist = tmp\n ans = i + 1\n \nprint(ans)', 'n, m = map(int, input().split())\nAB = [list(map(int, input().split())) for i in range(n)]\nCD = [list(map(int, input().split())) for i in range(m)]\n\nfor a, b in AB:\n dist = [[abs(a - c) + abs(b - d)] for c, d in CD]\n print(dist.index(min(dist)) + 1)']
['Wrong Answer', 'Accepted']
['s844852946', 's013637399']
[3064.0, 3064.0]
[19.0, 18.0]
[359, 254]
p03774
u999503965
2,000
262,144
There are N students and M checkpoints on the xy-plane. The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \leq j \leq M) is (c_j,d_j). When the teacher gives a signal, each student has to go to the nearest checkpoint measured in _Manhattan distance_. The Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|. Here, |x| denotes the absolute value of x. If there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index. Which checkpoint will each student go to?
['n,m=map(int,input().split())\n\na_lis=[list(map(int,input())) for i in range(n)]\nc_lis=[list(map(int,input())) for i in range(m)]\n\nfor i in range(n):\n num=0\n ans=10**8\n for j in reversed(range(m)):\n a=a_lis[i]\n c=c_lis[j]\n num=abs(a[0]-c[0])+abs(a[1]-c[1])\n ans=min(ans,num)\n if num==ans:\n cnt=j+1\n print(cnt)\n ', 'n,m=map(int,input().split())\n\na_lis=[list(map(int,input())) for i in range(n)]\nc_lis=[list(map(int,input())) for i in range(m)]\n\nfor i in range(n):\n num=0\n ans=10**10\n for j in reversed(range(m)):\n a=a_lis[i]\n c=c_lis[j]\n num=abs(a[0]-c[0])+abs(a[1]-c[1])\n ans=min(ans,num)\n if num==ans:\n cnt=j+1\n print(cnt)\n ', 'n,m=map(int,input().split())\n\na_lis=[list(map(int,input().split())) for i in range(n)]\nc_lis=[list(map(int,input().split())) for i in range(m)]\n\nfor i in range(n):\n num=0\n ans=10**10\n for j in reversed(range(m)):\n a=a_lis[i]\n c=c_lis[j]\n num=abs(a[0]-c[0])+abs(a[1]-c[1])\n ans=min(ans,num)\n if num==ans:\n cnt=j+1\n print(cnt)\n \n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s771375173', 's886796195', 's497663687']
[9116.0, 9112.0, 9192.0]
[22.0, 24.0, 30.0]
[336, 337, 354]
p03775
u005388620
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import math\n\nn = int(input())\na = math.sqrt(n)\n\nif n % a == 0.0:\n b = math.log10(a) + 1\n print(b)\nelse:\n a = int(a)\n while n % a != 0.0:\n a = a -1\n b = math.log10(a) + 1\n print(b)\n ', 'import math\n\n\nn = int(input())\na = math.sqrt(n)\n\nif n % a == 0.0:\n b = int(math.log10(a)) + 1\n print(b)\nelse:\n a = int(a)\n for i in range(a, 0, -1):\n \tif n % i == 0:\n \t\ta = n / i\n \t\tbreak\n b = int(math.log10(a)) + 1\n print(b)']
['Wrong Answer', 'Accepted']
['s124628837', 's748525318']
[2940.0, 3060.0]
[34.0, 30.0]
[213, 252]
p03775
u009787707
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['def cal1(n):\n num=(n**0.5)//1+1\n for i in range(num,n+1):\n if n//i==0:\n num=i\n break\n return num\n\nimport math\n\nN=int(input())\nnum=cal1(N)\nprint(int((math.log(num,10)+1)//1))', 'def cal(N):\n num=(N**0.5)//1\n num=int(num)\n for i in range(num,0,-1):\n if N%i==0:\n k=int(N/i)\n x=len(str(k))\n break\n return x\n\nprint(cal(int(input())))']
['Runtime Error', 'Accepted']
['s222391898', 's295806205']
[9416.0, 9348.0]
[29.0, 35.0]
[211, 199]
p03775
u013408661
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['n=int(input())\nans=10\nfor i in range(1,10**5+1):\n if n%i==0:\n ans=min(ans,len(str(n//i)))\nprint(ans)', 'n=int(input())\nans=10\nfor i in range(1,10**5+1):\n if n%i==0 and n//i>=i:\n ans=min(ans,len(str(n//i)))\nprint(ans)']
['Wrong Answer', 'Accepted']
['s180945242', 's421767928']
[2940.0, 3060.0]
[32.0, 32.0]
[104, 116]
p03775
u017050982
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import math\nN = int(input())\nfor i in range(1,int(math.sqrt(N))+1):\n if N % i == 0:\n ans = math.log10(N // i) // 1 + 1\nprint(ans)', 'import math\nN = int(input())\nfor i in range(1,int(math.sqrt(N))+1):\n if N % i == 0:\n ans = math.log10(N // i) // 1 + 1\nprint(int(ans))\n']
['Wrong Answer', 'Accepted']
['s598797236', 's032293134']
[9148.0, 9284.0]
[42.0, 42.0]
[139, 145]
p03775
u020604402
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['N = int(input())\nfor i in range(1,1+int(N)):\n if N % i == 0:\n tmp = i\ns = max(len(str(N // tmp)),len(str(tmp)))\nans = min(ans,s)', 'N = int(input())\nan = 10**10\nfor i in range(1,1+int(N)):\n if N % i == 0:\n tmp = i\n s = max(len(str(N // tmp)),len(str(tmp)))\n ans = min(ans,s)\nprint(ans)', 'N = int(input())\nfor i in range(1,1+int(N)):\n if N % i == 0:\n tmp = i\ns = max(len(str(N // tmp)),len(str(tmp)))\nans = min(ans,s)\nprint(ans)', 'N = int(input())\nfor i in range(1,1+int(N**(1/2))):\n if N % i == 0:\n tmp = i\nprint(max(len(str(N // tmp)),len(str(tmp))))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s544467668', 's704201504', 's926751358', 's243196355']
[2940.0, 3060.0, 2940.0, 3060.0]
[2104.0, 18.0, 2104.0, 33.0]
[138, 177, 149, 132]
p03775
u033963510
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['\n\nN = int(input())\ndef checklen(A, B):\n return max(len(str(A)), len(str(B)))\n\nans = float("inf")\nfor i in range(1,round(N/2):\n if N % i == 0:\n m = round(N/i)\n ans = min(checklen(i, m), ans)\nprint(ans)', '\nimport math\n\nN = int(input())\ndef checklen(A, B):\n return max(len(str(A)), len(str(B)))\n\nans = float("inf")\nM = round(math.sqrt(N))\nfor i in range(1, M+1):\n if N % i == 0:\n m = round(N/i)\n ans = min(checklen(i, m), ans)\nprint(ans)']
['Runtime Error', 'Accepted']
['s815007902', 's407732060']
[2940.0, 3188.0]
[17.0, 30.0]
[220, 251]
p03775
u037430802
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['def getPrimeFactorsList(num):\n pn = 2 \n pflist = [] \n while pn * pn <= num: \n while num % pn == 0: \n num = num / pn\n pflist.append(pn)\n pn += 1 \n if num > 1:\n pflist.append(int(num))\n \n return pflist\n\nn = int(input())\n\npf = getPrimeFactorsList(n)\npf_r = reversed(pf)\nprint(pf)\na = 1\nb = 1\nfor i in pf_r:\n if a >= b:\n b *= i\n else:\n a *= i\n\nprint(max([len(list(str(int(a)))), len(list(str(int(b))))]))', '\nN = int(input())\n\nans = 11\na = 1\ni = 1\nwhile i * i <= N:\n if N % i == 0:\n a = i\n b = N//a\n ans = min(ans, len(str((max(a,b)))))\n i += 1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s145304784', 's381382398']
[3064.0, 3060.0]
[35.0, 43.0]
[594, 175]
p03775
u038408819
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
["n = int(input())\nimport math\nans = float('Inf')\nsq = int(math.sqrt(n)) + 1\nfor i in range(1, sq):\n #print(i, n // i)\n if n % i != 0:\n continue\n print(i, n // i)\n ans = min(ans, max(len(str(i)), len(str(n // i))))\nprint(ans)", "n = int(input())\nimport math\nans = float('Inf')\nsq = int(math.sqrt(n)) + 1\nfor i in range(1, sq):\n #print(i, n // i)\n if n % i != 0:\n continue\n #print(i, n // i)\n ans = min(ans, max(len(str(i)), len(str(n // i))))\nprint(ans)\n"]
['Wrong Answer', 'Accepted']
['s898116844', 's051830566']
[3316.0, 3060.0]
[31.0, 30.0]
[242, 244]
p03775
u054556734
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import math\nn = int(input())\nnn = int(math.sqrt(n))\nwhile n%i != 0: i-=1\nprint(len(str(n//i)))\n', 'import math\nn = int(input())\nnn = int(math.sqrt(n))\nwhile n%nn != 0: nn-=1\nprint(len(str(n/nn)))', 'import math\nn = int(input())\nnn = int(math.sqrt(n))\nwhile n%nn != 0: nn-=1\nans = len(str(n/nn))\nprint(ans)', 'import math\nn = int(input())\na = int(math.sqrt(n))\nwhile n%a != 0: a-=1\nprint(len(str(n//a)))']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s424193083', 's518566407', 's797720163', 's830026366']
[2940.0, 2940.0, 3064.0, 3060.0]
[17.0, 36.0, 36.0, 32.0]
[95, 96, 106, 93]
p03775
u057109575
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['from math import sqrt\nN = int(input())\nans = []\nfor i in range(1, int(sqrt(N)) + 1):\n if i * (N // i) == N:\n ans.append(max(len(str(i)), len(str(N // i)))\nprint(min(ans))', 'from math import sqrt\nN = int(input())\nans = [1]\nfor i in range(1, int(sqrt(N))):\n if i * (N // i) == N:\n ans.append(max(len(str(i)), len(str(N // i))))\n \nprint(min(ans))', 'N = int(input())\nv = round(N ** 0.5)\nwhile N % v != 0:\n v -= 1\nprint(len(str(N // v)))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s334298508', 's631192298', 's309835163']
[2940.0, 3060.0, 3060.0]
[17.0, 38.0, 32.0]
[180, 187, 89]
p03775
u072606168
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
["import math\nn = int(input())\ndef f(n):\n g = float('inf')\n for i in [j for j in range(1,math.ceil(n**0.5))+1 if n%j == 0]:\n if g > len(str(max(i,n//i))):\n g = len(str(max(i,n//i)))\n if g == float('inf'):\n g = 1\n return g\nprint(f(n))", "n = int(input())\ndef f(n):\n g = float('inf')\n for i in range(1,n//2+1):\n if n % i == 0:\n if g > len(str(i))+len(str(n//i)):\n g = len(str(i))+len(str(n//i))\n return g\nprint(f(n))", "import math\nn = int(input())\ndef f(n):\n g = float('inf')\n for i in [j for j in range(1,math.ceil(n**0.5)+1) if n%j == 0]:\n if g > len(str(max(i,n//i))):\n g = len(str(max(i,n//i)))\n if g == float('inf'):\n g = 1\n return g\nprint(f(n))"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s582236352', 's964459002', 's123043377']
[3188.0, 3060.0, 3060.0]
[18.0, 2104.0, 28.0]
[252, 195, 252]
p03775
u074445770
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['\n#include <sstream>\n#include <cstdio>\n#include <cstdlib>\n#include <cmath>\n#include <ctime>\n#include <cstring>\n#include <string>\n\n#include <stack>\n\n#include <deque>\n#include <map>\n#include <set>\n#include <bitset>\n#include <numeric>\n#include <utility>\n#include <iomanip>\n#include <algorithm>\n#include <functional>\n\nusing namespace std;\n\n\n#define ALL(v) (v.begin(), v.end())\n#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl\n\n\ntemplate <class T>\ninline bool chmax(T &a, T b)\n{\n if (a < b)\n {\n a = b;\n return 1;\n }\n return 0;\n}\ntemplate <class T>\ninline bool chmin(T &a, T b)\n{\n if (a > b)\n {\n a = b;\n return 1;\n }\n return 0;\n}\ntemplate <class T1, class T2>\nostream &operator<<(ostream &s, pair<T1, T2> P)\n{\n return s << \'<\' << P.first << ", " << P.second << \'>\';\n}\ntemplate <class T>\nostream &operator<<(ostream &s, vector<T> P)\n{\n for (int i = 0; i < P.size(); ++i)\n {\n if (i > 0)\n {\n s << " ";\n }\n s << P[i];\n }\n return s;\n}\ntemplate <class T>\nostream &operator<<(ostream &s, vector<vector<T>> P)\n{\n for (int i = 0; i < P.size(); ++i)\n {\n s << endl\n << P[i];\n }\n return s << endl;\n}\ntemplate <class T>\nostream &operator<<(ostream &s, set<T> P)\n{\n EACH(it, P) { s << "<" << *it << "> "; }\n return s << endl;\n}\ntemplate <class T1, class T2>\nostream &operator<<(ostream &s, map<T1, T2> P)\n{\n EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; }\n return s << endl;\n}\ntypedef long long ll;\n\n#define EPS (1e-7)\n#define INF (1e9)\n#define PI (acos(-1))\n\nint func(long long num){\n int cnt = 0;\n while (num > 0)\n {\n num /= 10;\n cnt++;\n }\n return cnt;\n}\n\nint main()\n{\n long long n;\n cin >> n;\n int ans = INF;\n for (int i = 1; i <= sqrt(n) + 1; i++)\n {\n int tmp=INF;\n if (n % i == 0)\n {\n tmp = max(func(i), func(n / i));\n \n }\n ans = min(ans, tmp);\n }\n cout << ans << endl;\n}', 'def func(num):\n cnt=0\n while(num>0):\n num/=10\n cnt+=1\n return cnt\nN=int(input())\nans=100\nfor i in range(1,N**(1/2)+1):\n tmp=0\n if(N%i==0):\n tmp=max(func(i),func(N/i))\n ans=min(ans,tmp)\nprint(ans)', '\ndef func(num):\n cnt=0\n while(num>0):\n num=int(num/10)\n cnt+=1\n return cnt\n\nN=int(input())\nans=100\n\nfor i in range(1,int(N**(1/2)+1)):\n \n tmp=100\n if(N%i==0):\n \n tmp=max(func(i),func(N/i))\n ans=min(ans,tmp)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s245318923', 's376128935', 's184135171']
[2940.0, 3060.0, 3064.0]
[17.0, 17.0, 55.0]
[2266, 234, 437]
p03775
u075012704
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['N = int(input())\nF = 999;\nfor i in range(1,int(sqrt(N))+1):\n \n if N%i == 0: \n F = min(F , max( len(str(i)) , len(str(N//i)) ) )\nprint(F)\n ', 'N = int(input())\nF = 999;\nfor i in range(1,int(sqrt(N))+1):\n if N%i == 0: \n F = min(F , max( len(str(i)) , len(str(N//i)) ) )\nprint(F)\n ', 'N = int(input())\nF = 999;\nfor i in range(1,int(sqrt(N))+1):\n print(i)\n \n if N%i == 0: \n F = min(F , max( len(str(i)) , len(str(N//i)) ) )\nprint(F)\n ', 'from math import sqrt\n\n# C-Digits in Multiplication\n\n\nN = int(input())\nF = 999;\nfor i in range(1,int(sqrt(N))+1):\n \n if N%i == 0: \n F = min(F , max( len(str(i)) , len(str(N//i)) ) )\nprint(F)\n ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s092671982', 's526599327', 's973176164', 's775057013']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 30.0]
[292, 287, 305, 405]
p03775
u076936237
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
["import math\n\ndef F(A, B):\n return max(list(map(int, [math.log10(A), math.log10(B)])))+1\n\n\ndef main():\n N = int(input())\n max_ = 0\n for a in range(1, int(math.sqrt(N))+1):\n if N % a != 0:\n continue\n\n b = N/a\n v = F(a, b)\n print(a, v)\n if max_ < v:\n max_ = v\n print(v)\n\n\nif __name__ == '__main__':\n main()\n", "import math\n\ndef F(A, B):\n return max(list(map(int, [math.log10(A), math.log10(B)])))+1\n\n\ndef main():\n N = int(input())\n max_ = 0\n for a in range(1, int(math.sqrt(N))+1):\n if N % a != 0:\n continue\n\n b = N/a\n v = F(a, b)\n if max_ < v:\n max_ = v\n print(v)\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s399134788', 's622590947']
[3444.0, 3060.0]
[30.0, 27.0]
[379, 359]
p03775
u085334230
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['for A in range(1, int((N / 2))):\n if N % A == 0:\n B = int(N / A)\n if len(str(A)) <= len(str(B)):\n res = len(str(B))\n elif len(str(A)) >= len(str(B)):\n res = len(str(A))\n cont.append(res)\n else:\n continue\nprint(min(cont))', 'def make_divisors(n):\n divisors = []\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n // i)\n\n \n return divisors\n\n\nN = int(input())\nr = make_divisors(N)\nres = []\nfor i in r:\n y = N // i\n res.append(max(len(str(y)), len(str(i))))\nprint(min(res))']
['Runtime Error', 'Accepted']
['s559596451', 's061657965']
[3060.0, 3060.0]
[17.0, 27.0]
[283, 384]
p03775
u088863512
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['# -*- coding: utf-8 -*-\nimport sys\n# from collections import defaultdict, deque\nfrom math import log10, sqrt, ceil\ndef input(): return sys.stdin.readline()[:-1] # warning not \\n\n\n\ndef c(x):\n cnt = 0\n n = x\n while n:\n n //= 10\n cnt += 1\n return cnt\n\ndef solve():\n n = int(input())\n o = n\n ans = c(n)\n for i in range(2, ceil(sqrt(n)) + 1):\n while (n % i == 0):\n n //= i\n a = n\n b = o // a\n print(a,b)\n ans = min(ans, max(c(a), c(b)))\n if n == 1:\n break\n\n print(ans)\n \n \n\n\n\n\nt = 1\n# t = int(input())\nfor case in range(1,t+1):\n ans = solve()\n\n\n\n"""\n1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)\n100000007\n"""\n\n', '# -*- coding: utf-8 -*-\nimport sys\n# from collections import defaultdict, deque\nfrom math import log10, sqrt, ceil\ndef input(): return sys.stdin.readline()[:-1] # warning not \\n\n\n\ndef c(x):\n cnt = 0\n n = x\n while n:\n n //= 10\n cnt += 1\n return cnt\n\ndef solve():\n n = int(input())\n o = n\n ans = c(n)\n for i in range(2, int(sqrt(n)) + 3):\n if (n % i == 0):\n a = i\n b = o // a\n ans = min(ans, max(c(a), c(b)))\n if i > n:\n break\n\n print(ans)\n \n \n\n\n\n\nt = 1\n# t = int(input())\nfor case in range(1,t+1):\n ans = solve()\n\n\n\n"""\n1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)\n100000007\n"""\n\n']
['Wrong Answer', 'Accepted']
['s045091878', 's672017547']
[3064.0, 3064.0]
[30.0, 29.0]
[785, 737]
p03775
u095562538
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['# coding: utf-8\n# Here your code\n\n\n\nN = int(input())\nresult = len(str(N))\n\nfor i in range(1,int(pow(N,0.5))):\n if(N % i == 0):\n s = max(len(str(i)), len(str(N/i)))\n result = min(s,result)\nprint(result)\n\n\n', '# coding: utf-8\n# Here your code\n\n\n\nN = int(input())\nresult = len(str(N))\n\nfor i in range(1,int(pow(N,0.5)+1)):\n if(N % i == 0):\n s = max(len(str(i)), len(str(int(N/i))))\n result = min(s,result)\nprint(result)\n\n\n']
['Wrong Answer', 'Accepted']
['s422343625', 's626207166']
[3060.0, 3060.0]
[30.0, 30.0]
[221, 228]
p03775
u103099441
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['from math import sqrt\nn = int(input())\nx = n\ni = 2\nwhile i <= sqrt(n):\n if n % i == 0:\n x = n / i\n i += 1\nprint(len(str(x)))\n', 'from math import sqrt\nn = int(input())\nx = n\ni = 2\nwhile i <= sqrt(n):\n if n % i == 0:\n x = n / i\n i += 1\nprint(len(str(int(x))))\n']
['Wrong Answer', 'Accepted']
['s214922291', 's292511390']
[2940.0, 2940.0]
[58.0, 65.0]
[138, 143]
p03775
u106778233
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['N = int(input()) \nans = 111111111110\nfor i in range(int(N**0.5+2)):\n if N%i == 0:\n use = N//i \n s = str(use) \n t = str(i) \n ans = min(ans, max(len(s), len(t))) \n\nprint(ans)', 'N = int(input()) \nans = 111111111110\nfor i in range(1,int(N**0.5+2)):\n if N%i == 0:\n use = N//i \n s = str(use) \n t = str(i) \n ans = min(ans, max(len(s), len(t))) \n\nprint(ans)']
['Runtime Error', 'Accepted']
['s376068567', 's554526217']
[9444.0, 9424.0]
[24.0, 41.0]
[203, 205]
p03775
u111202730
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['N = int(input())\n\nans = [1]\nfor i in range(1, int(N**0.5)+1):\n if N % i == 0:\n tmp = max(len(str(i)), len(str(int(N/i))))\n ans.append(tmp)\n\nprint(min(ans))\n', 'N = int(input())\n\nans = []\nfor i in range(1, int(N**0.5)+1):\n if N % i == 0:\n ans.append(i)\n ans.append(int(N/i))\n\nif N == 1:\n print("1")\nelse:\n print(len(str(ans[-1])))\n']
['Wrong Answer', 'Accepted']
['s777057691', 's414026236']
[3188.0, 3060.0]
[31.0, 31.0]
[173, 193]
p03775
u111525113
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['n = int(input())\nfmax = 0\nfor i in range(1,n//2+1):\n a = i\n b = n // i\n if b != n/i :\n continue\n \n alen = len(str(a))\n blen = len(str(b))\n f = max(alen, blen)\n fmax = max(fmax,f)\nprint(fmax)', 'n = int(input())\nfmin = 100\nfor i in range(1,int(n**0.5)+1):\n a = i\n b = n // i\n if b != n/i :\n continue\n \n alen = len(str(a))\n blen = len(str(b))\n f = max(alen, blen)\n fmin = min(fmin,f)\nprint(fmin)']
['Wrong Answer', 'Accepted']
['s783934652', 's383516855']
[3064.0, 3064.0]
[2104.0, 53.0]
[201, 210]
p03775
u119655368
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['n = int(input())\nl = []\nfor i in range(1, int(math.sqrt(n)//1)):\n if n % i == 0:\n l.append(int(n / i))\nprint(len(str(l[-1])))', 'import math\nn = int(input())\nl = []\nfor i in range(1, int(math.sqrt(n)//1)+1):\n if n % i == 0:\n l.append(int(n / i))\nprint(len(str(l[-1])))']
['Runtime Error', 'Accepted']
['s368971589', 's583561516']
[2940.0, 3060.0]
[17.0, 30.0]
[135, 149]
p03775
u123729319
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['N = int(input())\n\nF = len(str(N))\nfor A in range(1, int(N**0.5)+1):\n if N%A != 0:\n continue\n B = N // A\n F = min(F, max([len(str(x)) for x in [A,B]]))\n print(F,A,B)\n\nprint(F)', 'N = int(input())\n\nF = len(str(N))\nfor A in range(1, int(N**0.5)+1):\n if N%A != 0:\n continue\n B = N // A\n F = min(F, max([len(str(x)) for x in [A,B]]))\n\nprint(F)']
['Wrong Answer', 'Accepted']
['s427803227', 's029621865']
[3316.0, 3060.0]
[31.0, 30.0]
[193, 176]
p03775
u126747509
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['\n#include <algorithm>\n#include <cmath>\n#include <string>\n\n\nusing namespace std;\n\n\nlong long f(long long a, long long b)\n{\n string x=to_string(a), y=to_string(b);\n return max(x.length(), y.length());\n}\n\n\nint main()\n{\n long long n, i, minv=100000000000;\n\n cin >> n;\n i = 1;\n while (i <= (long long)sqrt((long long)n)){\n if (n%i == 0 && f(i, n/i) < minv) minv = f(i, n/i);\n i++;\n }\n cout << minv << endl;\n \n return 0;\n}\n', 'import math\n\n\ndef f(a, b):\n return max(len(str(a)), len(str(b)))\n\n\ndef main():\n n = int(input())\n\n i = 1\n minv = 100000000000\n while i <= int(math.sqrt(n)):\n if n%i == 0 and f(i, n//i) < minv:\n minv = f(i, n//i)\n i += 1\n print(minv)\n \n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s315930496', 's090682450']
[2940.0, 3060.0]
[17.0, 63.0]
[452, 319]
p03775
u131405882
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import math\nN=int(input())\nnmax = math.floor(math.sqrt(N))\nBdigimax = 1\nfor i in range(1,nmax):\n\tif N % i == 0:\n\t\tBdigi = math.log10(N/i)\n\t\tif Bdigimax < Bdigi:\n\t\t\tBdigimax = Bdigi\nprint(int(Bdigimax))\n', 'import math\nN=int(input())\nif N==1:\n\tprint(1)\nelse:\n\tnmax = math.ceil(math.sqrt(N))\n\tBdigimin = 10\n\tfor i in range(nmax):\n\t\tif N % (i+1) == 0:\n\t\t\tBdigi = math.floor(math.log10(N/i))\n\t\t\tif Bdigimin > Bdigi:\n\t\t\t\tBdigimin = Bdigi\n\tprint(int(Bdigimin+1))\n', 'import math\nN=int(input())\nnmax = math.ceil(math.sqrt(N))\ni = 1\nBdigimin = 10\nwhile ( i <= nmax):\n\tif N % i == 0:\n\t\tBdigi = math.floor(math.log10(N/i))\n\t\tif Bdigimin > Bdigi:\n\t\t\tBdigimin = Bdigi\n\ti += 1\nprint(int(Bdigimin+1))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s078020420', 's464028590', 's577201954']
[2940.0, 3060.0, 3060.0]
[30.0, 17.0, 46.0]
[202, 251, 226]
p03775
u143492911
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['n=int(input())\nimport math\nans=[]\nans_i=[]\nfor i in range(1,int(math.sqrt(n))):\n if n%i==0:\n ans.append(i)\n ans_i.append(n//i)\nv=list(str(max(max(ans,ans_i))))\nprint(len(v))', 'n=int(input())\na=[]\nb=[]\nimport math\nfor i in range(1,math.ceil(math.sqrt(n)+1)):\n if n%i==0:\n a.append(i)\n b.append(n//i)\nc=[]\nfor i in range(len(a)):\n c.append(max(a[i],b[i]))\nd=str(min(c))\nprint(len(d))']
['Runtime Error', 'Accepted']
['s737782819', 's278025980']
[3060.0, 3064.0]
[30.0, 30.0]
[190, 225]
p03775
u146575240
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['# C - Digits in Multiplication\nN = int(input())\n\nA = int(N**0.5)\nprint(A)\nans = 1\nfor i in range(A+1,N,1):\n if N % i == 0:\n ans = len(str(i))\n break\n else:\n ans = len(str(i))\n\nprint(ans)\n', '# C - Digits in Multiplication\nN = int(input())\n\nA = int(N**0.5)\n# print(A)\nans = 1\nfor i in range(A,0,-1):\n if N % i == 0:\n tmp = N / i\n ans = len(str(int(tmp)))\n break\n else:\n pass\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s653514374', 's959734863']
[2940.0, 3060.0]
[2107.0, 31.0]
[214, 228]
p03775
u163874353
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['N, Y = map(int, input().split())\nfor i in range(N + 1):\n for j in range(N + 1 - i):\n k = int((Y - 10000 * i - 5000 * j) / 1000)\n if N - i - j >= k >= 0 and i + j + k == N:\n print(i, j, k)\n exit()\nprint(-1, -1, -1)', 'N = int(input())\nl = []\nfor A in range(1, int(N ** 0.5) + 1):\n B = N // A\n if N == A * B:\n \n l.append(max(len(str(A)), len(str(B))))\n \nprint(min(l))']
['Runtime Error', 'Accepted']
['s312993845', 's974301339']
[3060.0, 2940.0]
[18.0, 40.0]
[252, 187]
p03775
u172386990
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
["N = int(input())\n\ndef divisor(N):\n '''\n create divisor_list < sqrt(N) from natural number\n '''\n divisor_list = []\n \n for num in range(1, math.ceil(math.sqrt(N)) + 1):\n if N % num == 0:\n divisor_list.append(num)\n \n return divisor_list\n \ndef F(A, B):\n return max(len(str(A)), len(str(B)))\n \ndef minimumF(N):\n factoring_list = divisor(N)\n \n candidate_list = []\n \n for A in factoring_list:\n B = N // A\n candidate_list.append(F(A, B))\n \n return min(candidate_list)\n \nprint(minimumF(N))", "import math\n\nN = int(input())\n \ndef divisor(N):\n '''\n create divisor_list < sqrt(N) from natural number\n '''\n divisor_list = []\n \n for num in range(1, math.ceil(math.sqrt(N)) + 1):\n if N % num == 0:\n divisor_list.append(num)\n \n return divisor_list\n \ndef F(A, B):\n return max(len(str(A)), len(str(B)))\n \ndef minimumF(N):\n factoring_list = divisor(N)\n \n candidate_list = []\n \n for A in factoring_list:\n B = N // A\n candidate_list.append(F(A, B))\n \n return min(candidate_list)\n \nprint(minimumF(N))"]
['Runtime Error', 'Accepted']
['s351160897', 's726139884']
[3064.0, 3064.0]
[18.0, 27.0]
[569, 583]
p03775
u175746978
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['n = int(input())\nimport math\nr = math.sqrt(n)\nl1 = []\nl2 = []\nfor i in range(1, int(r+1)):\n if n % i == 0:\n a = i\n b = n / i\n if a <= b:\n l1.append([str(a), str(int(b))])\nprint(l1)\n\nfor j in l1:\n u = j[0]\n v = j[1]\n if len(u) >= len(v):\n f = len(j[0])\n else:\n f = len(j[1])\n l2.append(f)\n\nprint(min(l2))\n', 'n = int(input())\nimport math\nr = math.sqrt(n)\nl1 = []\nl2 = []\nfor i in range(1, int(r+1)):\n if n % i == 0:\n a = i\n b = n / i\n if a <= b:\n l1.append([str(a), str(int(b))])\nprint(l1)\n\nfor j in l1:\n u = j[0]\n v = j[1]\n if len(u) >= len(v):\n f = len(u)\n else:\n f = len(v)\n l2.append(f)\n\nprint(min(l2))\n', 'n = int(input())\nl1 = []\nfor i in range(1, n+1):\n if n % i == 0:\n a = i\n b = n / i\n if len(str(a)) >= len(str(b)):\n f = len(str(a))\n else:\n f = len(str(b))\n l1.append(f)\nprint(min(l1))\n', 'n = int(input())\nimport math\nr = math.sqrt(n)\nl1 = []\nl2 = []\nfor i in range(1, int(r+1)):\n if n % i == 0:\n a = i\n b = n / i\n if a <= b:\n l1.append([str(a), str(int(b))])\n\nfor j in l1:\n u = j[0]\n v = j[1]\n if len(u) >= len(v):\n f = len(u)\n else:\n f = len(v)\n l2.append(f)\n\nprint(min(l2))\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s297126331', 's422656366', 's427434920', 's761561121']
[3316.0, 3316.0, 3060.0, 3188.0]
[31.0, 32.0, 2104.0, 32.0]
[368, 362, 245, 352]
p03775
u180058306
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import numpy as np\n\n\nN = int(input())\nprint(N)\n\n\ndef F(A, B):\n C = np.vstack((A, B))\n digit_C = np.array(np.log10(C) + 1, dtype = int)\n return np.max(digit_C, axis = 0)\n\n\ndividend = np.ones(N) * N\n\ndivisor = np.arange(1, N + 1)\n\nresidue = dividend % divisor\n\n\nA = divisor[residue == 0]\nB = quotient[residue == 0]\n\n\nprint(np.min(F(A, B)))', 'import numpy as np\n\n\nN = int(input())\n\n\ndef F(A, B):\n C = np.vstack((A, B))\n digit_C = np.array(np.log10(C) + 1, dtype = int)\n return np.max(digit_C, axis = 0)\n\n\ndivisor = np.arange(1, int(N ** 0.5) + 1)\n\nquotient = N // divisor\nresidue = N % divisor\n\n\nA = divisor[residue == 0]\nB = quotient[residue == 0]\n\n\nprint(np.min(F(A, B)))']
['Runtime Error', 'Accepted']
['s827265120', 's355959592']
[1643580.0, 20748.0]
[1648.0, 321.0]
[620, 584]
p03775
u187109555
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import math\nN = int(input())\nmin_digits = 12\nfor a in range(1, round(math.sqrt(N))+1):\n if N%a !=0:\n continue\n b = N//a\n print(a, b)\n digits = max(len(str(a)), len(str(b)))\n if digits < min_digits:\n min_digits = digits\nprint(min_digits)', 'import math\nN = int(input())\nmin_digits = 12\nfor a in range(1, round(math.sqrt(N))+1):\n if N%a !=0:\n continue\n b = N//a\n digits = max(len(str(a)), len(str(b)))\n if digits < min_digits:\n min_digits = digits\nprint(min_digits)']
['Wrong Answer', 'Accepted']
['s624209650', 's718951211']
[3316.0, 3188.0]
[31.0, 30.0]
[265, 249]
p03775
u189023301
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['n = int(input())\nm = n * 1\n\nif n == 1:\n print(1)\n exit()\n\nsqr = int(n**0.5)\nl1 = len(str(sqr))\n\npf = {}\nfor i in range(2, int(m**0.5) + 1):\n while not m % i:\n pf[i] = pf.get(i, 0) + 1\n m //= i\nif m > 1:\n pf[m] = 1\n\nls = sorted(pf.items(), key=lambda x: x[0], reverse=True)\nl2 = len(str(ls[0][0]))\nother = n // ls[0][0]\nl3 = len(str(other))\n\nprint(max(l1, l2, l3))\n', 'n = int(input())\nm = n * 1\n\nif n == 1:\n print(1)\n exit()\n\nsqr = int(n**0.5)\nl1 = len(str(sqr))\n\npf = {}\nfor i in range(2, int(m**0.5) + 1):\n while not m % i:\n pf[i] = pf.get(i, 0) + 1\n m //= i\nif m > 1:\n pf[m] = 1\n\nls = sorted(pf.items(), key=lambda x: x[0], reverse=True)\nl2 = len(str(ls[0][0]))\nother = n // ls[0][0]\nl3 = len(str(other))\n\nif l1 <= l2 < l3:\n print(l3)\nelse:\n print(max(l1, l2))\n']
['Wrong Answer', 'Accepted']
['s430298970', 's291514409']
[3064.0, 3064.0]
[32.0, 30.0]
[390, 428]
p03775
u189397279
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import numpy as np\nN = int(input())\nans = 10 ** 10\nfor i in range(2:int(np.sqrt(N)) + 2):\n if not N % i:\n a = max(len(str(i)), len(str(int(121 / 11))))\n ans = min(ans, a)\nprint(a)', 'import numpy as np\n \nN = int(input())\nans = len(str(N))\nfor i in range(2, int(np.sqrt(N)) + 2):\n if not N % i:\n a = max(len(str(i)), len(str(int(N / i))))\n ans = min(ans, a)\nprint(ans)']
['Runtime Error', 'Accepted']
['s387344028', 's290782032']
[2940.0, 13648.0]
[17.0, 167.0]
[196, 201]
p03775
u191423660
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
["N = int(input())\n\nans1 = 0\n\nA = '1'\nB = str(N)\n\nif len(A)>=len(B):\n ans = len(A)\nelse:\n ans = len(B)\n \nfor i in range(2,N+1):\n A = i\n if N%A==0:\n B = int(N / A)\n A = str(A)\n B = str(B)\n print(A, B)\n if len(A)>=len(B):\n ans1 = len(A)\n else:\n ans1 = len(B)\n if ans1 <= ans:\n ans = ans1\n if len(str(A))==len(str(B)):\n break\nprint(ans)\n", "N = int(input())\n\nans1 = 0\n\nA = '1'\nB = str(N)\n\nif len(A)>=len(B):\n ans = len(A)\nelse:\n ans = len(B)\n \nfor i in range(2,N+1):\n A = i\n if N%A==0:\n B = int(N / A)\n A = str(A)\n B = str(B)\n print(A, B)\n if len(A)>=len(B):\n ans1 = len(A)\n else:\n ans1 = len(B)\n if ans1 <= ans:\n ans = ans1\n if len(str(A))==len(str(B)):\n break\nprint(ans)\n", "import math\n\nN = int(input())\n\nans1 = 0\n\nA = '1'\nB = str(N)\n\nif len(A)>=len(B):\n ans = len(A)\nelse:\n ans = len(B)\n \nfor i in range(2,int(math.sqrt(N)+1)):\n A = i\n if N%A==0:\n B = int(N / A)\n A = str(A)\n B = str(B)\n\n if len(A)>=len(B):\n ans1 = len(A)\n else:\n ans1 = len(B)\n if ans1 <= ans:\n ans = ans1\n if len(str(A))==len(str(B)):\n break\nprint(ans)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s506303619', 's577628870', 's052246606']
[3244.0, 3244.0, 3064.0]
[2104.0, 2104.0, 79.0]
[439, 439, 469]
p03775
u197968862
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['n = int(input())\nele = []\ni = 1\nwhile i * i < n:\n if n % i == 0:\n ele.append([len(str(i)),len(str(n // i))])\n i += 1\n\nk = min(ele[0][1],ele[0][0])\nfor i in range(len(ele)):\n k = min(max(ele[i][0],ele[i][1]),k)\nprint(k)', ' n = int(input())\nele = []\ni = 1\nwhile i * i <= n:\n if n % i == 0:\n ele.append([len(str(i)),len(str(n // i))])\n i += 1\n\nk = max(ele[0][1],ele[0][0])\nfor i in range(len(ele)):\n k = min(max(ele[i][0],ele[i][1]),k)\nprint(k)', 'n = int(input())\n\ne = []\ni = 1\nwhile i * i <= n:\n if n % i == 0:\n e.append([str(i),str(n//i)])\n i += 1\n\nans = 10**9\nfor i in range(len(e)):\n ans = min(max(len(e[i][1]),len(e[i][0])),ans)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s451763427', 's704475438', 's945014546']
[3064.0, 2940.0, 3188.0]
[52.0, 17.0, 47.0]
[234, 236, 213]
p03775
u201234972
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['N = int( input())\nans = len( str(N))\nfor i in range(1,int( N**(1/2))+1):\n if N%i == 0:\n ans = min( ans, max( len(i), len(N//i)))\n break\nprint(ans)', 'N = int( input())\nans = len( str(N))\nfor i in range(N//2,N):\n if N%i == 0:\n ans = min( ans, len( str(i)))\n break\nprint(ans)', 'N = int( input())\nans = len(N)\nfor i in range(N//2,N):\n if N%i == 0:\n ans = min( ans, len(i))\n break\nprint(ans)', 'N = int( input())\nans = len( str(N))\nfor i in range(1,int( N**(1/2))+1):\n if N%i == 0:\n ans = min( ans, max( len( str(i)), len( str(N//i))))\n break\nprint(ans)', 'N = int( input())\nans = len( str(N))\nfor i in range(1,int( N**(1/2))+1):\n if N%i == 0:\n ans = min( ans, max( len( str(i)), len( str(N//i))))\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s158117766', 's220174403', 's352971163', 's980743774', 's148166860']
[3060.0, 3064.0, 2940.0, 3060.0, 3060.0]
[18.0, 2104.0, 17.0, 17.0, 32.0]
[163, 140, 128, 175, 161]
p03775
u210827208
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['9876543210', 'n=int(input())\n\nx=int(n**0.5)\n\nfor i in range(x,0,-1):\n if n%i==0:\n a=str(i)\n b=str(n//i)\n print(max(len(a),len(b)))\n break']
['Wrong Answer', 'Accepted']
['s321820755', 's637073303']
[2940.0, 2940.0]
[17.0, 31.0]
[10, 154]
p03775
u212831449
2,000
262,144
You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 since 3 has one digit and 11 has two digits. Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.
['import math\n\nn = int(input())\n\nN = math.ceil(math.sqrt(n))\n\nans = 10**10\n\nfor a in range(N):\n try:\n amari = n%a\n if amari == 0:\n b = int(n / a)\n f = max(len(str(a)),len(str(b)))\n ans = min(f,ans)\n except ZeroDivisionError:\n print(1)\n exit()\n\nprint(ans)\n\n \n \n\n \n', 'import math\n\nn = int(input())\n\nN = math.ceil(math.sqrt(n))\n\nans = 10**10\n\nif n == 1:\n print(1)\n exit()\n\nfor a in range(1,N+1):\n amari = n%a\n if amari == 0:\n b = int(n / a)\n f = max(len(str(a)),len(str(b)))\n ans = min(f,ans)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s282298971', 's758211623']
[3060.0, 3188.0]
[17.0, 34.0]
[337, 268]