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
p02689
u624613992
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\nans = 0\nlist1 = [1] * (n)\nfor i in range(m):\n a, b = map(int, input().split())\n if h[a - 1] > h[b - 1]:\n list1[a - 1] = 0\n if h[a - 1] < h[b - 1]::\n list1[b - 1] = 0\nprint(sum(list1))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nans = 0\nlist1 = [1] * (n)\nfor i in range(m):\n a, b = map(int, input().split())\n if h[a - 1] > h[b - 1]:\n list1[a - 1] = 0\n if:\n list1[b - 1] = 0\nprint(sum(list1))', 'I = map(int, input().split())\nN, M = map(int, input().split())\nH = [0] + list(map(int, input().split()))\nO = [0] + [1] * N\nfor _ in range(M):\n A, B = map(int, input().split())\n if H[A] <= H[B]:\n O[A] = 0\n if H[A] >= H[B]:\n O[B] = 0\nprint(sum(O))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nlist1 = [1] * n\nfor _ in range(m):\n a, b = map(int, input().split())\n if h[a - 1] <= h[b - 1]:\n list1[a - 1] = 0\n if h[a - 1] >= h[b - 1]:\n list1[b - 1] = 0\nprint(sum(list1))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s210669035', 's461919096', 's814235704', 's489406137']
[9052.0, 9044.0, 17060.0, 20112.0]
[23.0, 22.0, 31.0, 273.0]
[275, 254, 268, 266]
p02689
u625007136
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import sys\ninput = sys.stdin.readline\n\ndef ppp(n,m,h,ab):\n g = [1] * n\n for l,r in ab:\n if h[l-1] >= h[r-1]:\n g[r-1] = 0\n if h[l-1] <= h[r-1]:\n g[l-1] = 0\n print(sum(g))\nif __name__ == "__main__":\n n,m = map(int,input().split())\n h = list(map(int,input().split()))\n ab = [list(map(int,input().split())) for _ in range(m)]\n ppp(n,m,h,ab_sorted)\n', 'import sys\ninput = sys.stdin.readline\n\ndef peaks(n,m,h,ab):\n g = [0] * n\n path = [ [i+1] for i in range(n)]\n print(ab)\n for l,r in ab:\n path[l-1].append(r)\n path[r-1].append(l)\n\n print(path)\n\n for i,p in enumerate(path):\n if h[i] >= max(p):\n g[i] = 1\n\n print(sum(g))\n\nif __name__ == "__main__":\n n,m = map(int,input().split())\n h = list(map(int,input().split()))\n ab = [list(map(int,input().split())) for _ in range(m)]\n ab_sorted = sorted(ab)\n peaks(n,m,h,ab_sorted)\n', 'import sys\ninput = sys.stdin.readline\n\ndef ppp(n,m,h,ab):\n g = [1] * n\n for l,r in ab:\n if h[l-1] >= h[r-1]:\n g[r-1] = 0\n if h[l-1] <= h[r-1]:\n g[l-1] = 0\n print(sum(g))\nif __name__ == "__main__":\n n,m = map(int,input().split())\n h = list(map(int,input().split()))\n ab = [list(map(int,input().split())) for _ in range(m)]\n ppp(n,m,h,ab)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s165848824', 's824334993', 's134846210']
[31152.0, 54804.0, 31944.0]
[146.0, 633.0, 193.0]
[401, 536, 394]
p02689
u626891113
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\np = [False] + [True]*n\nA = []\nB = []\nfor i in range(m):\n a, b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nfor i in range(m):\n if h[A[i] - 1] > h[B[i] - 1]:\n p[B[i]] = False\n if h[A[i] - 1] < h[B[i] - 1]:\n p[A[i]] = False\n if h[A[i] - 1] == h[B[i] - 1]:\n p[A[i]] = False\n p[B[i]] = False\n print(p)\nans = [i for i in range(n + 1) if p[i]]\n\nprint(len(ans))\n', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\np = [False] + [True]*n\nA = []\nB = []\nfor i in range(m):\n a, b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nfor i in range(m):\n if h[A[i] - 1] > h[B[i] - 1]:\n p[B[i]] = False\n elif h[A[i] - 1] < h[B[i] - 1]:\n p[A[i]] = False\n else:\n p[A[i]] = False\n p[B[i]] = False\n print(p)\nans = [i for i in range(n + 1) if p[i]]\n\nprint(len(ans))\n', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\np = [False] + [True]*n\nA = []\nB = []\nfor i in range(m):\n a, b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nfor i in range(m):\n if h[A[i] - 1] > h[B[i] - 1]:\n p[B[i]] = False\n elif h[A[i] - 1] < h[B[i] - 1]:\n p[A[i]] = False\n else:\n p[A[i]] = False\n p[B[i]] = False\n \nans = [i for i in range(n + 1) if p[i]]\n\nprint(len(ans))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s792304831', 's987381619', 's383968955']
[152456.0, 152436.0, 25352.0]
[907.0, 959.0, 287.0]
[482, 459, 451]
p02689
u629614915
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["## import\n\n\n\n## main process\nif __name__ == '__main__':\n \n ## input\n N, M = map(int,input().split())\n HEIGHT_LIST = list(map(int,input().split())) \n ROAD_LIST = []\n for j in range(M): \n ROAD_LIST.append(\n tuple(map(int,input().split()))\n )\n \n ## business logic\n ans = [1] * N\n for j in list(range(M)):\n point_a = ROAD_LIST[j][0]\n point_b = ROAD_LIST[j][1]\n\n point_a =- 1\n point_b =- 1\n\n height_a = HEIGHT_LIST[point_a]\n height_b = HEIGHT_LIST[point_b]\n\n if height_a < height_b:\n ans[point_a] = 0\n elif height_a > height_b:\n ans[point_b] = 0\n else:\n ans[point_a] = 0\n ans[point_b] = 0\n\n ## output\n print(sum(ans))", ' ## input\n N, M = map(int,input().split())\n HEIGHT_LIST = list(map(int,input().split())) \n ROAD_LIST = []\n for j in range(M): \n ROAD_LIST.append(\n set(map(int,input().split()))\n )\n \n ## business logic\n COUNT = 0\n \n for i in list(range(1, N+1)):\n unioned_i = set([])\n for k in ROAD_LIST:\n if i in k:\n unioned_i = unioned_i | k\n if len(unioned_i) == 0:\n COUNT = COUNT + 1\n continue\n HIGHT_i = HEIGHT_LIST[i-1]\n if HIGHT_i >= max(\n [ HEIGHT_LIST[l-1] for l in list(unioned_i) ]\n ):\n COUNT = COUNT + 1\n \n ## output\n print(COUNT)', "## import\n\n\n\n## main process\nif __name__ == '__main__':\n \n N, M = map(int,input().split())\n HEIGHT_LIST = list(map(int,input().split())) \n \n ans = [1] * N\n for j in range(M):\n a, b = map(int,input().split())\n a -= 1\n b -= 1\n height_a = HEIGHT_LIST[a]\n height_b = HEIGHT_LIST[b]\n\n if height_a < height_b:\n ans[point_a] = 0\n elif height_a > height_b:\n ans[point_b] = 0\n else:\n ans[point_a] = 0\n ans[point_b] = 0\n\n print(sum(ans))", "## import\n\n\n\n## main process\nif __name__ == '__main__':\n \n N, M = map(int,input().split())\n HEIGHT_LIST = list(map(int,input().split())) \n \n ans = [1] * N\n for j in range(M):\n a, b = map(int,input().split())\n a -= 1\n b -= 1\n height_a = HEIGHT_LIST[a]\n height_b = HEIGHT_LIST[b]\n\n if height_a < height_b:\n ans[point_a] = 0\n elif height_a > height_b:\n ans[point_b] = 0\n else:\n ans[point_a] = 0\n ans[point_b] = 0\n print(sum(ans))", "## import\n\n\n\n## main process\nif __name__ == '__main__':\n \n N, M = map(int,input().split())\n HEIGHT_LIST = list(map(int,input().split())) \n \n ans = [1] * N\n for j in range(M):\n a, b = map(int,input().split())\n a -= 1\n b -= 1\n height_a = HEIGHT_LIST[a]\n height_b = HEIGHT_LIST[b]\n\n if height_a < height_b:\n ans[a] = 0\n elif height_a > height_b:\n ans[b] = 0\n else:\n ans[a] = 0\n ans[b] = 0\n\n print(sum(ans))"]
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s498776323', 's749513732', 's781132786', 's869958686', 's452770043']
[31204.0, 8844.0, 20032.0, 20108.0, 20140.0]
[284.0, 22.0, 43.0, 44.0, 249.0]
[803, 700, 571, 570, 547]
p02689
u631429391
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['# n,m = map(int,input().split())\nh_list = list(map(int,input().split()))\nroads = []\nfor i in range(m):\n a,b = map(int,input().split())\n roads.append([a,b])\n#print(roads)\nterrace = [1] * n\nfor road in roads:\n if h_list[road[0]-1] > h_list[road[1]-1]:\n terrace[road[1]-1] = 0\n elif h_list[road[0]-1] == h_list[road[1]-1]:\n terrace[road[0]-1] = 0\n terrace[road[1]-1] = 0\n elif h_list[road[0]-1] < h_list[road[1]-1]:\n terrace[road[0]-1] = 0\nprint(terrace.count(1))', 'n,m = map(int,input().split())\nh_list = list(map(int,input().split()))\nroads = []\nfor i in range(m):\n a,b = map(int,input().split())\n roads.append([a,b])\n#print(roads)\nterrace = [1] * n\nfor road in roads:\n if h_list[road[0]-1] > h_list[road[1]-1]:\n terrace[road[1]-1] = 0\n elif h_list[road[0]-1] == h_list[road[1]-1]:\n terrace[road[0]-1] = 0\n terrace[road[1]-1] = 0\n elif h_list[road[0]-1] < h_list[road[1]-1]:\n terrace[road[0]-1] = 0\nprint(terrace.count(1))']
['Runtime Error', 'Accepted']
['s574677602', 's319069389']
[9236.0, 28956.0]
[25.0, 311.0]
[503, 501]
p02689
u632094970
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['# -*- coding: utf-8 -*-\n\nn, m = list(map(int, input().split()))\nh = list(map(int, input().split()))\nto = [[] for i in range(n)]\n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n print(a, b)\n to[a].append(b)\n to[b].append(a)\n\nans = 0\n\nfor i in range(n):\n ok = True\n for j in to[i]:\n if(h[i] <= h[j]):\n ok = False\n if(ok):\n ans += 1\n\nprint(ans)\n', '# -*- coding: utf-8 -*-\n\nn, m = list(map(int, input().split()))\nh = list(map(int, input().split()))\nto = [[] for i in range(n)]\n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n a -= 1\n b -= 1\n to[a].append(b)\n to[b].append(a)\n\nans = 0\n\nfor i in range(n):\n ok = True\n for j in to[i]:\n if(h[i] <= h[j]):\n ok = False\n if(ok):\n ans += 1\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s847244756', 's789312465']
[29264.0, 29432.0]
[641.0, 366.0]
[422, 406]
p02689
u651663683
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m=list(map(int,input().split()))\nh=list(map(int,input().split()))\nb=[[]for i in range(n)]\nfor i in range(m):\n a=list(map(lambda x:int(x)-1,input().split()))\n b[a[0]].append(a[1])\n b[a[1]].append(a[0])\ns=0\nfor i in range(n):\n f=1\n for j in b[i]:\n if h[i]<=h[j]:\n f=0\n break\n if f:\n s+=1', 'n,m=list(map(int,input().split()))\nh=list(map(int,input().split()))\nb=[[]for i in range(n)]\nfor i in range(m):\n a=list(map(lambda x:int(x)-1,input().split()))\n b[a[0]].append(a[1])\n b[a[1]].append(a[0])\ns=0\nfor i in range(n):\n f=1\n for j in b[i]:\n if h[i]<=h[j]:\n f=0\n break\n if f:\n s+=1\nprint(s)']
['Wrong Answer', 'Accepted']
['s422579661', 's953006085']
[29364.0, 29436.0]
[408.0, 418.0]
[309, 318]
p02689
u652522621
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["N, M = map(int, input().split(' '))\n\nheight = list(map(int, input().split(' ')))\nheight_all = height\n\nfor i range(M):\n a, b = map(int, input().split(' '))\n if height[a - 1] == height[b - 1]:\n height_all.remove(height[a - 1])\n elif height[a - 1] > height[b - 1]:\n height_all.remove(height[b - 1])\n else:\n height_all.remove(height[a - 1])\nprint(len(height_all))", "import numpy as np\nN, M = map(int, input().split(' '))\n\nheight = np.array(list(map(int, input().split(' '))))\n#height_all = height\n\nfor i in range(M):\n a, b = map(int, input().split(' '))\n #print(a, b, height[a - 1], height[b - 1])\n if height[a - 1] > height[b - 1]:\n height[b - 1] = 0\n \n else:\n height[a - 1] = 0\n \nprint(len(np.nonzero(height)))", "import numpy as np\nN, M = map(int, input().split(' '))\n\nheight = np.array(list(map(int, input().split(' '))))\nheight_all = np.array(list(height))\n\nfor i in range(M):\n a, b = map(int, input().split(' '))\n #print(a, b, height[a - 1], height[b - 1])\n if height[a - 1] > height[b - 1]:\n height_all[b - 1] = 0\n \n elif height[a - 1] == height[b - 1]:\n height_all[a - 1] = 0\n height_all[b - 1] = 0\n \n else:\n height_all[a - 1] = 0\n \n #print(height_all)\n \nprint(len(np.nonzero(height_all)[0]))"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s401471633', 's442665175', 's562572742']
[9048.0, 38580.0, 38600.0]
[22.0, 344.0, 383.0]
[372, 359, 510]
p02689
u652656291
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nH = list(map(int,input().split()))\np = [0]*n\nfor i in range(m):\n a,b = map(int,input().split())\n if H[a-1] >= H[b-1]:\n H[b-1] = -1\n if H[a-1] <= H[b-1]:\n H[a-1] = -1\nprint(p.count(0))\n', 'n,m = map(int,input().split())\nH = list(map(int,input().split()))\np = [0]*n\nfor i in range(m):\n a,b = map(int,input().split())\n if H[a-1] >= H[b-1]:\n p[b-1] = -1\n if H[a-1] <= H[b-1]:\n p[a-1] = -1\nprint(p.count(0))\n']
['Wrong Answer', 'Accepted']
['s557834774', 's135372805']
[20032.0, 20032.0]
[241.0, 248.0]
[238, 238]
p02689
u652892331
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nHeight = [int(i) for i in input().split()]\n\ncount = 0\nfor _ in range(M):\n A, B = map(int, input().split())\n if min(Height[A - 1], Height[B - 1]) != 0:\n count += 1\n Height[A - 1], Height[B - 1] = 0, 0\n\nfor i in Height:\n if i != 0:\n count += 1\n\nprint(count)', 'N, M = map(int, input().split())\nHeight = [int(i) for i in input().split()]\ncheck = [1] * N\n\nA_List = [0] * M\nB_List = [0] * M\nfor i in range(M):\n A, B = map(int, input().split())\n A_List[i] = A\n B_List[i] = B\n\n\n\nfor i in range(M):\n if Height[A_List[i] - 1] > Height[B_List[i] - 1]:\n check[B_List[i] - 1] = 0\n elif Height[A_List[i] - 1] < Height[B_List[i] - 1]:\n check[A_List[i] - 1] = 0\n elif Height[A_List[i] - 1] == Height[B_List[i] - 1]:\n check[B_List[i] - 1] = 0\n check[A_List[i] - 1] = 0\n\n\nprint(sum(check))']
['Wrong Answer', 'Accepted']
['s799017949', 's671554093']
[19980.0, 21856.0]
[262.0, 288.0]
[314, 559]
p02689
u657786757
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import collections\nn,m = list(map(int,input().split()))\ntower_high = list(map(int,input().split()))\ngood_tower = [1]*n\n\ndef check_tower(a,b):\n if tower_high[a]<tower_high[b]:\n good_tower[a]=0\n elif tower_high[a] > tower_high[b]:\n good_tower[b]=0\n else:\n good_tower[a]=0\n good_tower[b]=0\n\nfor i in range(m):\n a,b=list(map(int,input().split()))\n check_tower(a-1,b-1)\nprint(good_tower)\nprint(good_tower.count(1))\n', 'import collections\nn,m = list(map(int,input().split()))\ntower_high = list(map(int,input().split()))\ngood_tower = [1]*n\n\ndef check_tower(a,b):\n if tower_high[a]<tower_high[b]:\n good_tower[a]=0\n elif tower_high[a] > tower_high[b]:\n good_tower[b]=0\n else:\n good_tower[a]=0\n good_tower[b]=0\n\nfor i in range(m):\n a,b=list(map(int,input().split()))\n check_tower(a-1,b-1)\nprint(good_tower.count(1))\n']
['Wrong Answer', 'Accepted']
['s700435773', 's593861062']
[20620.0, 20648.0]
[296.0, 258.0]
[453, 435]
p02689
u660042112
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['if __name__ == "__main__":\n N, M = list(map(int, input().split()))\n H = list(map(int, input().split()))\n good_obs = [True for i in range(M)]\n for i in range(M):\n a, b = list(map(int, input().split()))\n if H[a-1] > H[b-1]:\n godd_obs[b-1] = False\n elif H[a-1] < H[b-1]:\n good_obs[a-1] = False\n print(sum(good_obs))\n\n\n', 'if __name__ == "__main__":\n N, M = list(map(int, input().split()))\n H = list(map(int, input().split()))\n adj_max = [0 for i in range(N)]\n for i in range(M):\n a, b = list(map(int, input().split()))\n if adj_max[a-1] < H[b-1]:\n adj_max[a-1] = H[b-1]\n if adj_max[b-1] < H[a-1]:\n adj_max[b-1] = H[a-1]\n num = 0\n for i in range(N):\n if H[i] > adj_max[i]:\n num += 1\n print(num)\n\n\n']
['Runtime Error', 'Accepted']
['s203366777', 's152569045']
[19972.0, 20128.0]
[48.0, 288.0]
[373, 455]
p02689
u667427469
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["if __name__ == '__main__':\n\n nm = input()\n nm = nm.split()\n n = int(nm[0])\n m = int(nm[1])\n\n h = input()\n h = h.split()\n h = list(map(int,h))\n print(h)\n AB = []\n for i in range(m):\n ab = input()\n ab = ab.split()\n ab = list(map(int,ab))\n AB.append(ab)\n\n s = set()\n for i in range(m):\n if h[AB[i][0]] > h[AB[i][0]]:\n s.add(AB[i][0])\n else:\n s.add(AB[i][1])\n\n print(len(s))\n", "if __name__ == '__main__':\n\n nm = input()\n nm = nm.split()\n n = int(nm[0])\n m = int(nm[1])\n\n h = input()\n h = h.split()\n h = list(map(int,h))\n\n AB = []\n ma = [0]*n\n for i in range(m):\n ab = input()\n ab = ab.split()\n ab = list(map(int,ab))\n ma[ab[0]-1] = max(ma[ab[0]-1],h[ab[1]-1])\n ma[ab[1]-1] = max(ma[ab[1]-1],h[ab[0]-1])\n\n ans = 0\n for i in range(n):\n if h[i] > ma[i]:\n ans += 1\n print(ans)\n"]
['Runtime Error', 'Accepted']
['s739864600', 's947388451']
[33916.0, 20104.0]
[327.0, 374.0]
[474, 487]
p02689
u667949809
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["n,m = map(int,input().split(' '))\nh = list(map(int,input().split(' ')))\nansList = [1]*n\nnumlist = []\n\nfor i in range(m):\n a,b = map(int, input().split())\n if h[a-1] > h[b-1]:\n #ansList[a-1] = ma\n numlist.append(b-1)\n else:\n numlist.append(a-1)\nfor i in list(set(numlist)):\n ansList[i] = 0\nprint(ansList.count(1))\n\nprint(set(numlist))\nprint(ansList)", "n,m = map(int,input().split(' '))\nh = list(map(int,input().split(' ')))\nansList = [1]*n\nnumlist = []\n\nfor i in range(m):\n a,b = map(int, input().split())\n if h[a-1] > h[b-1]:\n #ansList[a-1] = ma\n numlist.append(b-1)\n elif h[a-1] == h[b-1]:\n numlist.append(a-1)\n numlist.append(b-1)\n else:\n numlist.append(a-1)\nfor i in list(set(numlist)):\n ansList[i] = 0\nprint(ansList.count(1))"]
['Wrong Answer', 'Accepted']
['s358449367', 's524231169']
[20880.0, 20300.0]
[296.0, 262.0]
[381, 428]
p02689
u671861352
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['#!python3\n\n# input\nN, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(M)]\n\n\ndef main():\n link = [[] for _ in range(N)]\n for a, b in AB:\n link[a - 1].append(b - 1)\n link[b - 1].append(a - 1)\n\n ans = N\n for i in range(N):\n for x in link[i]:\n if H[i] <= H[x]:\n print(i, H[i], x, H[x])\n ans -= 1\n break\n \n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', '#!python3\n\n# input\nN, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(M)]\n\n\ndef main():\n link = [[] for _ in range(N)]\n for a, b in AB:\n link[a - 1].append(b - 1)\n link[b - 1].append(a - 1)\n\n ans = N\n for i in range(N):\n for x in link[i]:\n if H[i] <= H[x]:\n ans -= 1\n break\n \n print(ans)\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s503365989', 's771818823']
[47892.0, 47532.0]
[451.0, 379.0]
[525, 485]
p02689
u671889550
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M=map(int,input().split())\nH=list(map(int,input().split()))\nP=[]\nfor i in range(M):\n P.append(list(map(int,input().split()))) \n\nans=[]\n\nfor i in range(M):\n if H[P[i][0]-1]>H[P[i][1]-1]: \n ans.append([P[i][0])\n elif H[P[i][0]-1]<H[P[i][1]-1]: \n ans.append(P[i][1]) \n else: \n continue \n \nlist=[]\n\nfor j in range(M): \n list+=P[j]\n\nprint(len(set(ans))+N-len(set(list)))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = []\nfor _ in range(m):\n l.append(list(map(int, input().split())))\n\nbad = []\nfor i in range(m):\n if h[l[i][0] - 1] > h[l[i][1] - 1]:\n bad.append(l[i][1])\n elif h[l[i][0] - 1] < h[l[i][1] - 1]:\n bad.append(l[i][0])\n else:\n bad.append(l[i][0])\n bad.append(l[i][1])\n\nprint(n - len(set(bad)))']
['Runtime Error', 'Accepted']
['s536715252', 's079881895']
[8960.0, 34656.0]
[27.0, 328.0]
[600, 375]
p02689
u674588203
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M=map(int,input().split())\nhs=input().split()\n\nH=[0] \nfor h in hs:\n H.append(int(h))\n\n\nP=[[0]*1 for i in range(N+1)] \ncount=0\nfor p in range(len(P)):\n P[p][0]=p \n# print(P)\n\nfor m in range(M):\n pathfrom,pathto= map (int,input().split())\n P[pathfrom].append(H[pathto])\n P[pathto].append(H[pathfrom])\nprint(P)\nfor i in range(1,len(P)):\n P[i][0]=H[i]\n if P[i][0]>=max(P[i]):\n count+=1\nprint(count)', 'N,M=map(int,input().split())\nhs=input().split()\nH=[0] \nP=[[0]*1 for i in range(N+1)] \ncount=0\nfor p in range(len(P)):\n P[p][0]=p\n# print(P)\nfor h in hs:\n H.append(int(h))\n\nfor m in range(M):\n pathfrom,pathto= map (int,input().split())\n P[pathfrom].append(H[pathto])\n P[pathto].append(H[pathfrom])\nfor i in range(1,len(P)):\n P[i][0]=H[i]\n if P[i][0]>max(P[i]):\n count+=1\nprint(count)', 'N,M=map(int,input().split())\nhs=input().split()\nH=[0]\nP=[[0]*1 for i in range(N+1)] \ncount=0\nfor p in range(len(P)):\n P[p][0]=p\n# print(P)\nfor h in hs:\n H.append(int(h))\n\nfor m in range(M):\n pathfrom,pathto= map (int,input().split())\n P[pathfrom].append(H[pathto])\n P[pathto].append(H[pathfrom])\nfor i in range(len(P)):\n P[i][0]=H[i]\n if P[i][0]>max(P[i]):\n count+=1\nprint(count)', 'N,M=map(int,input().split())\nhs=input().split()\nH=[0]\nP=[[0]*1 for i in range(N+1)] \ncount=0\nfor p in range(len(P)):\n P[p][0]=p\n# print(P)\nfor h in hs:\n H.append(int(h))\n\nfor m in range(M):\n pathfrom,pathto= map (int,input().split())\n P[pathfrom].append(H[pathto])\n P[pathto].append(H[pathfrom])\nfor i in range(len(P)):\n P[i][0]=H[i]\n if P[i][0]>=max(P[i]):\n count+=1\nprint(count)', 'N,M=map(int,input().split())\nhs=input().split()\n\nH=[0] \nfor h in hs:\n H.append(int(h))\n\n\nP=[[0]*1 for i in range(N+1)] \ncount=0\nfor p in range(len(P)):\n P[p][0]=p \n# print(P)\n\nfor m in range(M):\n pathfrom,pathto= map (int,input().split())\n P[pathfrom].append(H[pathto])\n P[pathto].append(H[pathfrom])\nfor i in range(1,len(P)):\n P[i][0]=H[i]\n if P[i][0]>max(P[i]) and len(P[i])>1:\n count+=1\nprint(count)', 'N,M=map(int,input().split())\nhs=input().split()\n\nH=[0] \nfor h in hs:\n H.append(int(h))\n\n\nP=[[0]*1 for i in range(N+1)] \ncount=0\nfor p in range(len(P)):\n P[p][0]=p \n# print(P)\n\nfor m in range(M):\n pathfrom,pathto= map (int,input().split())\n P[pathfrom].append(H[pathto])\n P[pathto].append(H[pathfrom])\nfor i in range(1,len(P)):\n if len(P[i])==1:\n count+=1\n else:\n P[i][0]=H[i]\n _rP=P[i][1:]\n if P[i][0]>max(_rP):\n count+=1\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s128285162', 's216492020', 's265674078', 's437973522', 's975681575', 's620828120']
[43800.0, 36316.0, 36292.0, 36264.0, 36232.0, 36688.0]
[539.0, 459.0, 458.0, 437.0, 420.0, 444.0]
[615, 545, 483, 484, 621, 685]
p02689
u678505520
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nh = list(map(int,input().split()))\nH = set(range(n))\nprint(h)\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] <= h[b-1]:\n H.discard(a-1)\n if h[a-1] >= h[b-1]:\n H.discard(b-1)\n\nprint(len(H))', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\nH = set(range(n))\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] <= h[b-1]:\n H.discard(a-1)\n if h[a-1] >= h[b-1]:\n H.discard(b-1)\n\nprint(len(H))']
['Wrong Answer', 'Accepted']
['s740383367', 's816117831']
[22588.0, 22452.0]
[324.0, 284.0]
[257, 248]
p02689
u680190333
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
[" import sys\ninput=sys.stdin.readline\n\nN,M=(int(x) for x in input().rstrip('\\n').split())\nHs = [int(x) for x in input().rstrip('\\n').split()]\nnums = [1 for x in Hs]\nfor i in range(M):\n roads = [int(x) for x in input().rstrip('\\n').split()]\n if Hs[roads[0]-1] < Hs[roads[1]-1]:\n nums[roads[0]-1] = 0\n elif Hs[roads[0]-1] > Hs[roads[1]-1]:\n nums[roads[1]-1] = 0\n else:\n nums[roads[0]-1] = 0\n nums[roads[1]-1] = 0\nprint(sum(nums))", "import sys\ninput=sys.stdin.readline\n\nN,M=(int(x) for x in input().rstrip('\\n').split())\nHs = [int(x) for x in input().rstrip('\\n').split()]\nnums = [1 for x in Hs]\nfor i in range(M):\n roads = [int(x) for x in input().rstrip('\\n').split()]\n if Hs[roads[0]-1] < Hs[roads[1]-1]:\n nums[roads[0]-1] = 0\n elif Hs[roads[0]-1] > Hs[roads[1]-1]:\n nums[roads[1]-1] = 0\n else:\n nums[roads[0]-1] = 0\n nums[roads[1]-1] = 0\nprint(sum(nums))"]
['Runtime Error', 'Accepted']
['s584821745', 's774729756']
[9004.0, 20144.0]
[24.0, 161.0]
[442, 441]
p02689
u681409497
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int,input().split())\nheight = list(map(int,input().split()))\nbet,cost = [],[0]*N\nfor i in range(M):\n bet.append(list(map(int,input().split())))\n\nfor b in bet:\n if height[b[0]-1] < height[b[1]-1]:\n cost[b[1]-1] = 1\n else:\n cost[b[0]-1] = 1\n\nprint(cost)\n', 'n,m = map(int,input().split())\nh = list(map(int,input().split())\njudge = [True] * n\n\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] >= h[b-1]:\n judge[b-1] = False\n else:\n judge[a-1] = False\n \nprint(judge.count(True))', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\njudge = [True] * n\n\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] == h[b-1]:\n judge[a-1],judge[b-1] =False, False\n elif h[a-1] > h[b-1]:\n judge[b-1] = False\n else:\n judge[a-1] = False\n\nprint(judge.count(True))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s767016126', 's852819664', 's214363291']
[32660.0, 8836.0, 20112.0]
[319.0, 27.0, 252.0]
[287, 261, 325]
p02689
u684267998
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M= list(map(int, input().split())) \nH = list(map(int, input().split())) \nA = [0]*M\nB = [0]*M\n\nfor i in range(M):\n A[i], B[i]= map(int, input().split())\n \nans = []*N\nfor i in range(M):\n a = A[i]-1\n b = B[i]-1\n if H[a] < H[b]:\n ans[a]=1\n elif H[a] > H[b]:\n ans[b]=1\n else:\n ans[a]=0\n ans[b]=0\nprint(ans.count(1))', 'N,M= list(map(int, input().split())) \nH = list(map(int, input().split())) \nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i], B[i]= map(int, input().split())\nans = set([])\nfor i in range(M):\n a = A[i]-1\n b = B[i]-1\n if H[a] <= H[b]:\n ans.add(B[i])\n else:\n ans.add(A[i])\nlen(ans)', 'N,M= list(map(int, input().split())) \nH = list(map(int, input().split())) \nA = [0]*M\nB = [0]*M\nans = [1]*N\n\nfor i in range(M):\n A[i], B[i]= map(int, input().split())\n \n\nfor i in range(M):\n a = A[i]-1\n b = B[i]-1\n if H[a] < H[b]:\n ans[a]=0\n elif H[a] > H[b]:\n ans[b]=0\n else:\n ans[a]=0\n ans[b]=0\n \nprint(ans.count(1))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s171449965', 's270914392', 's092081819']
[20920.0, 23648.0, 21832.0]
[211.0, 277.0, 266.0]
[361, 302, 372]
p02689
u689710606
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\narr = [0] + list(map(int, input().split()))\ng = [[] for _ in range(n + 1)]\nfor _ in range(m):\n a, b = map(int, input().split())\n g[a].append(b)\n g[b].append(a)\n\nans = 0\nfor i in range(1, n + 1):\n for j in g[i]:\n if arr[j] >= arr[i]:\n break\n else:\n ans += 1\n\nprint(ans)\n', 'n, m = map(int, input().split())\narr = [0] + list(map(int, input().split()))\ng = [[] for _ in range(n + 1)]\nfor _ in range(m):\n a, b = map(int, input().split())\n g[a].append(b)\n g[b].append(a)\n\nans = 0\nfor i in range(1, n + 1):\n for j in g[i]:\n if arr[j] >= arr[i]:\n break\n else:\n ans += 1\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s841426671', 's264762752']
[29520.0, 29132.0]
[330.0, 368.0]
[350, 342]
p02689
u690554532
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl_n = [True] * n\nfor i in range(m):\n a, b = map(int, input().split())\n elif h[a-1] >= h[b-1]:\n l_n[b-1] = False\n elif h[a-1] <= h[b-1]:\n l_n[a-1] = False\nprint(sum(l_n)) ', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl_n = [True] * n\nfor i in range(m):\n a, b = map(int, input().split())\n elif h[a-False] >= h[b-False]:\n l_n[b-False] = False\n elif h[a-False] <= h[b-False]:\n l_n[a-False] = False\nprint(sum(l_n)) ', "import sys\ndef main():\n input = sys.stdin.readline\n n, m = map(int, input().split())\n h = list(map(int, input().split()))\n l_n = [True] * n\n for i in range(m):\n a, b = map(int, input().split())\n if h[a-1] == h[b-1]:\n l_n[b-1] = False\n l_n[a-1] = False\n elif h[a-1] <= h[b-1]:\n l_n[a-1] = False\n elif h[a-1] >= h[b-1]:\n l_n[b-1] = False\n print(sum(l_n)) \n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s386324060', 's780146317', 's010753219']
[8964.0, 9028.0, 20368.0]
[23.0, 21.0, 141.0]
[262, 286, 482]
p02689
u692311686
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M=map(int,input().split())\nH=list(map(int,input().split()))\ntunagari=[[] for i in range(N)]\nfor i in range(M):\n A,B=map(int,input().split())\n tunagari[A-1]+=[B-1]\n tunagari[B-1]+=[A-1]\n\nnums=[0 for i in range(N)]\nt=0\nfor i in range(N):\n tmpl=tunagari[i]\n mini=min(tmpl)\n if mini<i:\n nums[i]=nums[mini]\n continue\n nums[i]=t\n t+=1\nmaxn=max(nums)\ngroups=[[] for i in range(maxn+1)]\nfor i in range(N):\n groups[nums[i]]+=[i]\nans=0\nfor i in range(maxn):\n tmpl=groups[i]\n tmpl2=[]\n for i in tmpl:\n tmpl2+=[H[i]]\n n=len(tmpl)\n if n==1:\n ans+=1\n else:\n tmpl2.sort()\n if tmpl2[-1]!=tmpl2[-2]:\n ans+=1\nprint(ans)', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\ntunagari=[[] for i in range(N)]\nTF=[True for i in range(N)]\nfor i in range(M):\n A,B=map(int,input().split())\n if H[A-1]>H[B-1]:\n TF[B-1]=False\n elif H[A-1]<H[B-1]:\n TF[A-1]=False:\n else:\n TF[A-1]=False\n TF[B-1]=False\nans=0\nfor i in range(N):\n if TF[i]==True:\n ans+=1\nprint(ans)', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\ntunagari=[[] for i in range(N)]\nfor i in range(M):\n A,B=map(int,input().split())\n tunagari[A-1]+=[B-1]\n tunagari[B-1]+=[A-1]\nans=0\nfor i in range(N):\n tmpl=tunagari[i]\n n=len(tmpl)\n if n==0 :\n ans+=1\n else:\n for j in range(n):\n tmpl[j]=H[tmpl[j]]\n maxh=max(tmpl)\n if maxh<H[i]:\n ans+=1\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s406080692', 's803451910', 's654957052']
[30324.0, 9048.0, 29268.0]
[333.0, 22.0, 433.0]
[641, 359, 388]
p02689
u694380052
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m=map(int,input().split())\nhl=input().split()\nshl=[int(x) for x in hl]\nvl=set()\nfor y in range(n):\n vl.add(y)\nprint(vl)\nfor i in range(m):\n try:\n a,b=map(int,input().split())\n if shl[a-1]>shl[b-1]:\n vl.remove(b-1)\n elif shl[a-1]<shl[b-1]:\n vl.remove(a-1)\n else:\n vl.remove(a-1)\n vl.remove(b-1)\n except:\n continue\nlshl=len(shl)\nlvl=len(vl)\nans=lshl-lvl\nprint(ans)\n', 'n,m=map(int,input().split())\nhl=int(input().split())n,m=map(int,input().split())\nhl=input().split()\nshl=[int(x) for x in hl]\nvl=set()\nfor y in range(n):\n vl.add(y)\nprint(vl)\nfor i in range(m):\n try:\n a,b=map(int,input().split())\n if shl[a-1]>shl[b-1]:\n vl.remove(b-1)\n elif shl[a-1]<shl[b-1]:\n vl.remove(a-1)\n else:\n vl.remove(a-1)\n vl.remove(b-1)\n except:\n continue\nlshl=len(shl)\nlvl=len(vl)\nans=lshl-lvl\nprint(ans)', 'n,m=map(int,input().split())\nhl=input().split()\nshl=[int(x) for x in hl]\nvl=set()\nfor i in range(m):\n a,b=map(int,input().split())\n if shl[a-1]>shl[b-1]:\n vl.add(b-1)\n elif shl[a-1]<shl[b-1]:\n vl.add(a-1)\n else:\n vl.add(a-1)\n vl.add(b-1)\n print(vl)\nlshl=len(shl)\nlvl=len(vl)\nans=lshl-lvl\nprint(ans)', 'n,m=map(int,input().split())\nhl=input().split()\nshl=[int(x) for x in hl]\nvl=set()\nfor i in range(m):\n a,b=map(int,input().split())\n if shl[a-1]>shl[b-1]:\n vl.add(b-1)\n elif shl[a-1]<shl[b-1]:\n vl.add(a-1)\n else:\n vl.add(a-1)\n vl.add(b-1)\nlshl=len(shl)\nlvl=len(vl)\nans=lshl-lvl\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s087674989', 's112624276', 's122921035', 's020426227']
[29452.0, 8956.0, 146676.0, 24600.0]
[329.0, 25.0, 1830.0, 273.0]
[453, 504, 341, 327]
p02689
u700929101
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['x = list(map(int,input().split(" ")))\nn,m = x\nh = list(map(int,input().split(" ")))\nlowerlist = [1] * n\nprint(h)\n\nfor i in range(m):\n ab = list(map(int,input().split(" ")))\n a,b = ab\n print(a)\n print(b)\n # print(ab)\n if h[a-1] >= h[b-1]:\n lowerlist[b-1] = 0\n if h[b-1] >= h[a-1]:\n lowerlist[a-1] = 0\n print(lowerlist)\n\nprint(sum(lowerlist))', 'x = list(map(int,input().split(" ")))\nn,m = x\nh = list(map(int,input().split(" ")))\nlowerlist = [1] * n\n\nfor i in range(m):\n ab = list(map(int,input().split(" ")))\n a,b = ab\n # print(ab)\n if h[a-1] >= h[b-1]:\n lowerlist[b-1] = 0\n if h[b-1] >= h[a-1]:\n lowerlist[a-1] = 0\n\nprint(sum(lowerlist))']
['Wrong Answer', 'Accepted']
['s954546185', 's219621929']
[124224.0, 20124.0]
[2371.0, 275.0]
[378, 322]
p02689
u703823201
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nH = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for m in range(M)]\nAB = list(map(list, set(map(tuple, AB))))\n\ni = []\nfor m in range(len(AB)):\n a = AB[m][0]\n b = AB[m][1]\n if H[a-1] >= H[b-1]:\n i.append(b-1)\n elif H[a-1] <= H[b-1]:\n i.append(a-1)\n\ni = list(set(i))\nfor x in i:\n H[i] = 0\n\ncnt = H.count(0)\nprint(len(H)-cnt)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for m in range(M)]\nAB = list(map(list, set(map(tuple, AB))))\n\ni = []\nfor m in range(len(AB)):\n a = AB[m][0]\n b = AB[m][1]\n if H[a-1] > H[b-1]:\n i.append(b-1)\n elif H[a-1] < H[b-1]:\n i.append(a-1)\n else:\n i.append(a-1)\n i.append(b-1)\n\ni = list(set(i))\nprint(len(H)-len(i))']
['Runtime Error', 'Accepted']
['s716618338', 's502556547']
[50220.0, 50392.0]
[440.0, 411.0]
[409, 421]
p02689
u711143961
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = [int(i) for i in input().split()]\nh = [int(i) for i in input().split()]\nhs = [[] for i in range(n)]\nfor i in range(m):\n a, b = [int(i) for i in input().split()]\n hs[a-1].append(h[b-1])\n hs[b-1].appned(h[a-1])\nc = 0\nfor i in range(n):\n if len(hs[i]) == 0:\n c += 1\n elif h[i] > max(hs[i]):\n c += 1\nprint(c)', 'n, m = [int(i) for i in input().split()]\nh = [int(i) for i in input().split()]\nhs = [[] for i in range(n)]\nfor i in range(m):\n a, b = [int(i) for i in input().split()]\n hs[a-1].append(h[b-1])\n hs[b-1].append(h[a-1])\nc = 0\nfor i in range(n):\n if len(hs[i]) == 0:\n c += 1\n elif h[i] > max(hs[i]):\n c += 1\nprint(c)']
['Runtime Error', 'Accepted']
['s437357161', 's356580425']
[20156.0, 22996.0]
[65.0, 377.0]
[322, 340]
p02689
u712322283
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int, input().split())\nhs = list(map(int, input().split()))\nd = [1]*n\n\nfor i in range(m):\n a,b = map(int, input().split())\n if hs[a-1] <= hs[b-1]:\n d[a-1] = 0\n if hs[a-1] >= hs[b-1]:\n d[b-1] = 0\n \n print(hs,d)\n \nprint(d.count(1))', 'n,m = map(int, input().split())\nhs = list(map(int, input().split()))\nd = [1]*n\n\nfor i in range(m):\n a,b = map(int, input().split())\n if hs[a-1] <= hs[b-1]:\n d[a-1] = 0\n if hs[a-1] >= hs[b-1]:\n d[b-1] = 0\n \nprint(d.count(1))']
['Runtime Error', 'Accepted']
['s491701452', 's402923832']
[141780.0, 20020.0]
[2240.0, 261.0]
[274, 249]
p02689
u713165870
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['if __name__ == "__main__":\n list_N_M = input().split(\' \')\n N = int(list_N_M[0])\n M = int(list_N_M[1])\n \n list_str_H_all = input().split(\' \')\n H = [0.0] * N\n for i in range(len(list_str_H_all)):\n H[i] = float(list_str_H_all[i])\n \n is_good_vp = [True] * N\n \n for _ in range(M):\n str_A_B = input().split(\' \')\n A = int(str_A_B[0])\n B = int(str_A_B[1])\n \n if H[A-1] > H[B-1]:\n is_good_vp[B-1] = False\n elif H[B-1] > H[A-1]:\n is_good_vp[A-1] = False\n \n output = 0\n for i in N:\n if is_good_vp[i]:\n output += 1\n \n print(output)', 'if __name__ == "__main__":\n list_N_M = input().split(\' \')\n N = int(list_N_M[0])\n M = int(list_N_M[1])\n \n list_str_H_all = input().split(\' \')\n H = [0.0] * N\n for i in range(len(list_str_H_all)):\n H[i] = float(list_str_H_all[i])\n \n is_good_vp = [True] * N\n \n for _ in range(M):\n str_A_B = input().split(\' \')\n A = int(str_A_B[0])\n B = int(str_A_B[1])\n \n if H[A-1] > H[B-1]:\n is_good_vp[B-1] = False\n elif H[B-1] > H[A-1]:\n is_good_vp[A-1] = False\n \n output = 0\n for i in rabge(N):\n if is_good_vp[i]:\n output += 1\n \n print(output)\n', 'if __name__ == "__main__":\n list_N_M = input().split(\' \')\n N = int(list_N_M[0])\n M = int(list_N_M[1])\n \n list_str_H_all = input().split(\' \')\n H = [0] * N\n for i in range(len(list_str_H_all)):\n H[i] = int(list_str_H_all[i])\n \n is_good_vp = [True] * N\n \n for _ in range(M):\n str_A_B = input().split(\' \')\n A = int(str_A_B[0])\n B = int(str_A_B[1])\n \n if H[A-1] > H[B-1]:\n is_good_vp[B-1] = False\n elif H[B-1] > H[A-1]:\n is_good_vp[A-1] = False\n else:\n is_good_vp[A-1] = False\n is_good_vp[B-1] = False\n \n output = 0\n for i in range(N):\n if is_good_vp[i]:\n output += 1\n \n print(output)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s233000512', 's507230261', 's364164470']
[21528.0, 21556.0, 20804.0]
[260.0, 256.0, 270.0]
[580, 588, 654]
p02689
u716660050
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M=map(int,input().split())\nH=list(map(int,input().split()))\nl=[0]*N\nnice=0\nfor i in range(M):\n A,B=map(int,input().split())\n A-=1\n B-=1\n if l[A] == 0:\n l[A] = B\n nice += 1\n if l[B]==0:\n l[B] = -1\n elif l[A] == -1:\n l[A] = B\n if l[B]==0:\n l[B] = -1\n elif H[l[A]] < H[B]:\n l[A] = B\nprint(nice+l.count(0))', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\nl=[1]*N\nfor i in range(M):\n A,B=map(int,input().split())\n A-=1\n B-=1\n if H[A] <= H[B]:\n l[A] = 0\n if H[A] >= H[B]:\n l[B] = 0\nprint(l.count(1))']
['Wrong Answer', 'Accepted']
['s637395982', 's138888668']
[19924.0, 20020.0]
[261.0, 260.0]
[386, 233]
p02689
u719840207
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N , M = map(int,input().split())\nh = list(map(int, input().split()))\ngraph = [[] for _ in range(N)]\nfor _ in range(M):\n a , b = map(int,input().split())\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\nans=0\n\nnewg=[]\nfor j in graph:\n \n newg.append(set(j))\n\n\nfor index,i in enumerate(newg):\n judge=0\n for j in i:\n print(index , j,ans)\n if h[index] >= h[j]:\n judge=1\n if h[index] < h[j]:\n judge=0\n break\n if judge==1:\n ans+=1\nprint(ans)\n ', 'N , M = map(int,input().split())\nh = list(map(int, input().split()))\ngraph = [[] for _ in range(N)]\nfor _ in range(M):\n a , b = map(int,input().split())\n graph[a - 1].append(b - 1)\n graph[b - 1].append(a - 1)\nans=0\n \nfor index,i in enumerate(graph):\n judge=1\n for j in i:\n if h[index] <= h[j]:\n judge=0\n break\n if judge==1:\n ans+=1\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s676695432', 's494769056']
[55576.0, 29356.0]
[606.0, 385.0]
[531, 397]
p02689
u723345499
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\npairs = [list(map(int, input().split())) for _ in range(m)]\n\nans = [1] * n\n\nfor i in range(m):\n if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:\n ans[pairs[i][0] - 1] = 0\n elif f h[pairs[i][0] - 1] = h[pairs[i][1] - 1]:\n ans[pairs[i][0] - 1] = 0\n ans[pairs[i][1] - 1] = 0 \n else:\n ans[pairs[i][1] - 1] = 0 \n\nprint(sum(ans))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\npairs = [list(map(int, input().split())) for _ in range(m)]\n\nans = [-1] * n\n\nfor i in range(m):\n if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:\n ans[pairs[i][0] - 1] = 0\n if ans[pairs[i][1] - 1] != 0:\n ans[pairs[i][1] - 1] = 1\n else:\n if ans[pairs[i][0] - 1] !=0:\n ans[pairs[i][0] - 1] = 1\n ans[pairs[i][1] - 1] = 0 \n print(ans)\nfor i in range(n):\n if ans[i] == -1:\n ans[i] = 1\nprint(ans)\nprint(sum(ans))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\npairs = [list(map(int, input().split())) for _ in range(m)]\n\nans = [1] * n\n\nfor i in range(m):\n if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:\n ans[pairs[i][0] - 1] = 0\n elif h[pairs[i][0] - 1] = h[pairs[i][1] - 1]:\n ans[pairs[i][0] - 1] = 0\n ans[pairs[i][1] - 1] = 0 \n else:\n ans[pairs[i][1] - 1] = 0 \n\nprint(sum(ans))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\npairs = [list(map(int, input().split())) for _ in range(m)]\n\nans = [1] * n\n\nfor i in range(m):\n if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:\n ans[pairs[i][0] - 1] = 0\n elif h[pairs[i][0] - 1] == h[pairs[i][1] - 1]:\n ans[pairs[i][0] - 1] = 0\n ans[pairs[i][1] - 1] = 0 \n else:\n ans[pairs[i][1] - 1] = 0 \n\nprint(sum(ans))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s076569439', 's142824666', 's919793113', 's303985027']
[8920.0, 161688.0, 8972.0, 31812.0]
[21.0, 2273.0, 25.0, 311.0]
[429, 556, 427, 428]
p02689
u725993280
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nh = list(map(int,input().split()))\n\na = [list(map(int,input().split())) for i in range(m)]\n\nans = []\n\nfor i in range(m):\n if h[a[i][0]-1] < h[a[i][1]-1]:\n ans.append(a[i][0]-1)\n else:\n ans.append(a[i][1]-1)\n \nans = set(ans)\nans = int(len(h)) - int(len(ans))\n\nprint(h)\nprint(a)\nprint(ans)', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\n\na = [list(map(int,input().split())) for i in range(m)]\n\nans = []\n\nfor i in range(m):\n if h[a[i][0]-1] > h[a[i][1]-1]:\n ans.append(a[i][1])\n elif h[a[i][0]-1] < h[a[i][1]-1]:\n ans.append(a[i][0])\n if h[a[i][0]-1] == h[a[i][1]-1]:\n ans.append(a[i][0])\n ans.append(a[i][1])\n \n\nans = set(ans)\n\nprint(int(len(h)) - int(len(ans)))\n#2,3,5\n\n1,4,4']
['Wrong Answer', 'Accepted']
['s480827595', 's977921824']
[37792.0, 34480.0]
[354.0, 334.0]
[341, 449]
p02689
u729133443
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['(n,_),h,*t=[[*map(int,t.split())]for t in open(0)]\np=[1]*n\nfor a,b in t:p[-a]&=h[a]>h[b];p[-b]&=h[b]>h[a]\nprint(sum(p))', 'n,h,*t=[[*map(int,t.split())]for t in open(0)]\np=[1]*n[0]\nfor a,b in t:x,y=h[a-1],h[b-1];p[-a]&=x>y;p[-b]&=y>x\nprint(sum(p))']
['Runtime Error', 'Accepted']
['s333579612', 's812850752']
[32144.0, 32148.0]
[199.0, 210.0]
[119, 124]
p02689
u729915102
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = [int(i) for i in input().split()]\n\nload = [list(map(int, input().split())) for _ in range(m)]\n\nresult = {i: 0 for i in range(n)}\n\nfor l in load:\n a, b = l[0]-1, l[1]-1\n #print(a,b)\n if h[a] < h[b]:\n result[b] += 1\n\n#print(result)\nprint(sum(result.values()))', 'n, m = map(int, input().split())\nh = [int(i) for i in input().split()]\nload = [list(map(int, input().split())) for _ in range(m)]\nresult = {i: 1 for i in range(n)}\n\nfor l in load:\n a, b = l[0] - 1, l[1] - 1\n if h[a] < h[b]:\n result[a] = 0\n elif h[a] > h[b]:\n result[b] = 0\n elif h[a] == h[b]:\n result[a] = 0\n result[b] = 0\n\nprint(sum(result.values()))']
['Wrong Answer', 'Accepted']
['s707804908', 's958969296']
[42716.0, 42680.0]
[327.0, 349.0]
[310, 391]
p02689
u732061897
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nH = list(map(int, input().split()))\nresults = []\nresultsSet = set()\nfor i in range(M):\n A, B = map(int, input().split())\n setAB = set([A, B])\n if resultsSet.isdisjoint(setAB):\n results.append(setAB)\n resultsSet = resultsSet | setAB\n else:\n resultsSet = resultsSet | setAB\n for result in results:\n if not result.isdisjoint(set([A])):\n result.add(A)\n break\n if result.isdisjoint(set([B])):\n result.add(B)\n break\n\nnaimono = N - len(resultsSet)\nresult_conunt = len(results)\n#print(list(resultsSet), results)\n\nprint(naimono + result_conunt)\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nroutes = dict()\nfor i in range(M):\n A, B = map(int, input().split())\n if routes.get(A) is None:\n routes[A] = set([B])\n else:\n routes[A].add(B)\n if routes.get(B) is None:\n routes[B] = set([A])\n else:\n routes[B].add(A)\n\n#print(routes)\nanswer = 0\nfor i in range(1, N + 1):\n if routes.get(i) is None:\n answer += 1\n else:\n tmp = 0\n for j in routes.get(i):\n tmp = max(tmp, H[j - 1])\n if H[i - 1] > tmp:\n answer += 1\nprint(answer)']
['Wrong Answer', 'Accepted']
['s398296739', 's748040367']
[20072.0, 45276.0]
[2206.0, 613.0]
[722, 591]
p02689
u740267532
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int,input().split())\nH = list(map(int,input().split()))\ncount = 0\nfor _ in range(M):\n A, B = map(int,input().split())\n if H[B-1] < H[A-1]:\n count +=1\n if H[B-1] > H[A-1]:\n count +=1\nprint(count)', 'N, M = map(int,input().split())\nH = list(map(int,input().split()))\nl = []\ncount = 0\nfor _ in range(M):\n A, B = map(int,input().split())\n if B in l:\n if A not in l:\n if H[A-1] < H[B-1]:\n count +=1\n if A in l:\n if B not in l:\n if H[A-1] > H[B-1]:\n count +=1\n l.append(A)\n l.append(B)\nprint(count)', 'N, M = map(int,input().split())\nH = list(map(int,input().split()))\ncount = 0\nfor _ in range(M):\n A, B = map(int,input().split())\n if H[B-1] > H[A-1]:\n count +=1\nprint(count)', 'N, M = map(int,input().split())\nH = list(map(int,input().split()))\nans = [0]*N\nfor _ in range(M):\n A, B = map(int,input().split())\n if H[A-1] >= H[B-1]:\n ans[B-1] = 1\n if H[A-1] <= H[B-1]:\n ans[A-1] = 1\nprint(ans.count(0))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s033711015', 's310821061', 's819459957', 's946079592']
[20108.0, 20120.0, 20016.0, 20028.0]
[258.0, 2206.0, 237.0, 269.0]
[228, 375, 186, 245]
p02689
u745687363
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nH = list(map(int, input().split()))\nX=[[0] for i in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n X[a-1].append(b)\n X[b-1].append(a)\nt=0\nfor i in range(n):\n E=list(H[k-1] for k in X[i])\n if max(E) < H[i]:\n t+=1\nprint(t)', 'n, m = map(int, input().split())\nH = list(map(int, input().split()))\nX=[[] for i in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n X[a-1].append(b)\n X[b-1].append(a)\nt=0\nfor i in range(n):\n E=[0]+list(H[k-1] for k in X[i])\n if max(E) < H[i]:\n t+=1\nprint(t)']
['Wrong Answer', 'Accepted']
['s467690781', 's477490050']
[32744.0, 30608.0]
[428.0, 480.0]
[278, 281]
p02689
u745861782
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = list(map(int, input().split()))\nheights = list(map(int, input().split()))\nflags = [True] * n\ncount = 0\nfor _ in range(m):\n roots = list(map(int, input().split()))\n if heights[roots[0] - 1] > heights[roots[1] - 1]:\n flags[roots[1] - 1] = False\n elif heights[roots[0] - 1] < heights[roots[1] - 1]:\n flags[roots[0] - 1] = False\n else:\n flags[roots[1] - 1] = False\n flags[roots[0] - 1] = False\nfor flag in flags:\n if flag:\n count += 1', 'n, m = list(map(int, input().split()))\nheights = list(map(int, input().split()))\nflags = [True] * n\ncount = 0\nfor _ in range(m):\n roots = list(map(int, input().split()))\n if heights[roots[0] - 1] > heights[roots[1] - 1]:\n flags[roots[1] - 1] = False\n elif heights[roots[0] - 1] < heights[roots[1] - 1]:\n flags[roots[0] - 1] = False\n else:\n flags[roots[1] - 1] = False\n flags[roots[0] - 1] = False\nfor flag in flags:\n if flag:\n count += 1\nprint(count)']
['Wrong Answer', 'Accepted']
['s620258243', 's252901430']
[19956.0, 20000.0]
[276.0, 279.0]
[457, 470]
p02689
u749301160
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().rstrip().split())\nh = map(int, input().rstrip().split())\nl = []\nhigh = [0] * n\ncount = 0\n\nfor i in range(m):\n a, b = map(int, input().rstrip().split())\n l.append([a, b])\n\nfor i in l:\n if h[i[0]-1] < h[i[1]-1]:\n high[i[0]-1] += 1\n elif h[i[0]-1] == h[i[1]-1]:\n high[i[0]-1] += 1\n high[i[1]-1] += 1\n else:\n high[i[1]-1] += 1\n\nfor hi in high:\n if hi == 0:\n count += 1\nprint(count)', 'n, m = map(int, input().rstrip().split())\nh = list(map(int, input().rstrip().split()))\nl = []\nhigh = [0] * n\ncount = 0\n\nfor i in range(m):\n a, b = map(int, input().rstrip().split())\n l.append([a, b])\n\nfor i in l:\n if h[i[0]-1] < h[i[1]-1]:\n high[i[0]-1] += 1\n elif h[i[0]-1] == h[i[1]-1]:\n high[i[0]-1] += 1\n high[i[1]-1] += 1\n else:\n high[i[1]-1] += 1\n\nfor hi in high:\n if hi == 0:\n count += 1\nprint(count)']
['Runtime Error', 'Accepted']
['s376197249', 's928430610']
[32480.0, 28776.0]
[236.0, 316.0]
[454, 460]
p02689
u749416810
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m=map(int,input())\nh=list(map(int,input().split()))\ntall=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1\n b-=1\n tall[a]=max(tall[a],h[b])\n tall[b]=max(tall[b],h[a])\nres=0\nfor i in range(n):\n if h[i]>tall[i]:\n res+=1\nprint(res)', 'n,m=map(int,input())\nh=list(map(int,input().split( )))\ntall=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1\n b-=1\n tall[a]=max(tall[a],h[b])\n tall[b]=max(tall[b],h[a])\nres=0\nfor i in range(n):\n if h[i]>tall[i]:\n res+=1\nprint(res)', 'n,m=map(int,input())\nh=list(map(int,input().split(" ")))\ntall=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1\n b-=1\n tall[a]=max(tall[a],h[b])\n tall[b]=max(tall[b],h[a])\nres=0\nfor i in range(n):\n if h[i]>tall[i]:\n res+=1\nprint(res)', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\ntall=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1\n b-=1\n tall[a]=max(tall[a],h[b])\n tall[b]=max(tall[b],h[a])\nres=0\nfor i in range(n):\n if h[i]>tall[i]:\n res+=1\nprint(res)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s434718765', 's475589623', 's622933279', 's748271511']
[9220.0, 9224.0, 9072.0, 19992.0]
[25.0, 21.0, 21.0, 334.0]
[250, 251, 253, 258]
p02689
u749742659
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int, input().split())\nheight = list(map(int, input().split()))\nroads = [list(map(int, input().split())) for i in range(m)]\n\nbestcount = 0\n\nfor i in range(n):\n best = 1 \n for j in range(m):\n if (roads[j][0] == i):\n a = roads[j][0]\n b = roads[j][1]\n if (height[a] <= height[b]):\n best = 0\n break\n if (roads[j][1] == i):\n a = roads[j][1]\n roads[j][0] == b\n if (height[a] <= height[b]):\n best = 0\n break\n if(best == 1):\n bestcount += 1\n\nprint(str(bestcount))', 'n,m = map(int, input().split())\nheight = list(map(int, input().split()))\nroads = [list(map(int, input().split())) for i in range(m)]\n\nbestcount = 0\n\nprint(height)\nprint(roads)\n\nfor i in range(n):\n best = 1 \n for j in range(m):\n if (roads[j][0] == i):\n a = roads[j][0]\n b = roads[j][1]\n if (height[a] <= height[b]):\n best = 0\n break\n if (roads[j][1] == i):\n a = roads[j][1]\n b = roads[j][0]\n if (height[a] <= height[b]):\n best = 0\n break\n if(best == 1):\n bestcount += 1\n\nprint(str(bestcount))', 'n,m = map(int, input().split())\nheight = list(map(int, input().split()))\n\nroads = [[] for i in range(n)]\nfor i in range(m):\n x,y = map(int, input().split())\n roads[x-1].append(y-1)\n roads[y-1].append(x-1)\n\nprint(roads)\n\nbestcount = 0\n\nfor i in range(n):\n best = 1 \n for j in roads[i]:\n if (height[j] >= height[i]):\n best = 0\n break\n if(best == 1):\n bestcount += 1\n\nprint(str(bestcount))', 'n,m = map(int, input().split())\nheight = list(map(int, input().split()))\n\nroads = [[] for i in range(n)]\nfor i in range(m):\n x,y = map(int, input().split())\n roads[x-1].append(y-1)\n roads[y-1].append(x-1)\n\nbestcount = 0\n\nfor i in range(n):\n best = 1 \n for j in roads[i]:\n if (height[j] >= height[i]):\n best = 0\n break\n if(best == 1):\n bestcount += 1\n\nprint(str(bestcount))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s062602471', 's594559110', 's996207271', 's259468580']
[31216.0, 35020.0, 33376.0, 29400.0]
[2207.0, 2211.0, 432.0, 389.0]
[644, 671, 464, 450]
p02689
u750485713
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, K = map(int, input().split())\n\nH = input().split()\nH2 = [0] * N\nfor i in range(K):\n a, b = map(int, input().split())\n if H[a-1] > H[b-1]:\n H2[b-1] = 1\n elif H[a-1] < H[b-1]:\n H2[a-1] = 1\n elif H[a-1] == H[b-1]:\n H2[b-1] = 1\n H2[a-1] = 1\n\ncount = 0\nfor i in H2:\n if i == 0:\n count+=1\nprint(count, end = "")', 'N, K = map(int, input().split())\n\nH = input().split()\nH2 = [0] * N\nfor i in range(K):\n a, b = map(int, input().split())\n if int(H[a-1]) > int(H[b-1]):\n H2[b-1] = 1\n elif int(H[a-1]) < int(H[b-1]):\n H2[a-1] = 1\n elif int(H[a-1]) == int(H[b-1]):\n H2[b-1] = 1\n H2[a-1] = 1\ncount = 0\nfor i in H2:\n if i == 0:\n count+=1\nprint(count)']
['Wrong Answer', 'Accepted']
['s258938312', 's397857595']
[17748.0, 17432.0]
[276.0, 302.0]
[358, 377]
p02689
u750651325
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float("inf")\n\nN = k()\ncount = 0\nfor i in range(1,N+1):\n t = N//i\n count += i * t*(t+1)/2\nprint(int(count))\n', 'import re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float("inf")\n\nN, M = I()\nH = l()\ngood = [1]*N\nfor k in range(M):\n A, B = map(int, input().split())\n if H[A - 1] >= H[B - 1]:\n good[B - 1] = 0\n if H[A - 1] <= H[B - 1]:\n good[A - 1] = 0\nprint(sum(good))\n\n']
['Runtime Error', 'Accepted']
['s777461104', 's529157752']
[10524.0, 22040.0]
[37.0, 285.0]
[630, 743]
p02689
u756030237
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\n\nhigh_list = list(map(int, input().split()))\ncheck_list = [1]*N\n\nfor i in range(M):\n a_, b_ = map(int, input().split())\n if high_list[a_-1] < high_list[b_-1]:\n check_list[a_-1] = 0\n elif high_list[a_-1] > high_list[b_-1]:\n check_list[b_-1] = 0\n elif high_list[a_-1] == high_list[b_-1]:\n check_list[a_-1] = 0\n check_list[b_-1] = 0\n\nprint(len(check_list))', 'N, M = map(int, input().split())\n \nhigh_list = list(map(int, input().split()))\ncheck_list = [1]*N\n \nfor i in range(M):\n a_, b_ = map(int, input().split())\n if high_list[a_-1] < high_list[b_-1]:\n check_list[a_-1] = 0\n elif high_list[a_-1] > high_list[b_-1]:\n check_list[b_-1] = 0\n elif high_list[a_-1] == high_list[b_-1]:\n check_list[a_-1] = 0\n check_list[b_-1] = 0\n \nprint(sum(check_list))']
['Wrong Answer', 'Accepted']
['s909072375', 's892518852']
[20044.0, 20112.0]
[246.0, 244.0]
[402, 405]
p02689
u769411997
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nH = list(map(int, input().split()))\nA, B = [], []\nfor i in range(m):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\ntmp = [0] * n\ncnt = [0] * n\n\nnum = []\nres = 0\nfor i in range(1, n+1):\n if i not in A and i not in B:\n num.append(i)\n\nfor i in range(m):\n print("i",i)\n if H[A[i]-1] >= H[B[i]-1]:\n print(H[A[i]-1])\n tmp[A[i]-1] += 1\n cnt[A[i]-1] += 1\n cnt[B[i]-1] += 1\n elif H[A[i]-1] < H[B[i]-1]:\n print(H[B[i]-1])\n tmp[B[i]-1] += 1\n cnt[A[i]-1] += 1\n cnt[B[i]-1] += 1\n\nprint(tmp)\nprint(cnt)\n\nfor i in range(n):\n if tmp[i] == cnt[i] and tmp[i] != 0:\n res += 1\nprint(res+len(num))', 'n, m = map(int, input().split())\nH = list(map(int, input().split()))\nA = [0]*n\nfor i in range(m):\n a, b = map(int, input().split())\n A[a-1] = max(A[a-1], H[b-1])\n A[b-1] = max(A[b-1], H[a-1])\nans = 0\nfor i in range(n):\n if H[i] > A[i]:\n ans += 1\nprint(H)\nprint(A)\nprint(ans)', 'n, m = map(int, input().split())\nH = list(map(int, input().split()))\nA = [0]*n\nfor i in range(m):\n a, b = map(int, input().split())\n A[a-1] = max(A[a-1], H[b-1])\n A[b-1] = max(A[b-1], H[a-1])\nans = 0\nfor i in range(n):\n if H[i] > A[i]:\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s101821903', 's890336178', 's334817533']
[23200.0, 19960.0, 19992.0]
[2206.0, 377.0, 309.0]
[717, 293, 276]
p02689
u773065853
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['h = [int(x) for x in input().split()]\nl = [1] * n\nfor i in range(m):\n\ta, b = map(int, input().split())\n\tif h[a-1] >= h[b-1]:\n\t\tl[b-1] = 0\n\tif h[b-1] >= h[a-1]:\n\t\tl[a-1] = 0\nprint(sum(l))', 'n, m = map(int, input().split())\nh = [int(x) for x in input().split()]\nl = [1] * n\nfor i in range(m):\n\ta, b = map(int, input().split())\n\tif h[a-1] >= h[b-1]:\n\t\tl[b-1] = 0\n\tif h[b-1] >= h[a-1]:\n\t\tl[a-1] = 0\nprint(sum(l))']
['Runtime Error', 'Accepted']
['s731277359', 's650082505']
[9200.0, 20112.0]
[21.0, 254.0]
[186, 219]
p02689
u773440446
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nh = list(map(int,input().split()))\n\nl = [0] * N\n\nfor i in range(M):\n A,B = map(int,input().split())\n if h[A-1] > h[B-1]:\n l[B - 1] = 0\n elif H[A - 1] < H[B - 1]:\n l[A - 1] = 0\n elif H[A - 1] == H[B - 1]:\n l[A - 1], l[B - 1] = 0, 0\nprint(l.count(1))', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\n\nl = [1] * N\n\nfor i in range(M):\n A,B = map(int,input().split())\n if h[A-1] > h[B-1]:\n l[B - 1] = 0\n elif H[A - 1] < H[B - 1]:\n l[A - 1] = 0\n elif H[A - 1] == H[B - 1]:\n l[A - 1], l[B - 1] = 0, 0\nprint(l.count(1))\n', 'n,m = map(int,input().split())\nH = list(map(int,input().split()))\n\nl = [1] * N\n\nfor i in range(n):\n A,B = map(int,input().split())\n if H[A-1] > h[B-1]:\n l[B - 1] = 0\n elif H[A - 1] < H[B - 1]:\n l[A - 1] = 0\n elif H[A - 1] == H[B - 1]:\n l[A - 1], l[B - 1] = 0, 0\nprint(l.count(1))\n', 'n,m = map(int,input().split())\nH = list(map(int,input().split()))\n\nl = [1] * n\n\nfor i in range(n):\n A,B = map(int,input().split())\n if H[A-1] > H[B-1]:\n l[B - 1] = 0\n elif H[A - 1] < H[B - 1]:\n l[A - 1] = 0\n elif H[A - 1] == H[B - 1]:\n l[A - 1], l[B - 1] = 0, 0\nprint(l.count(1))\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nl = [1] * N\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A - 1] > H[B - 1]:\n l[B - 1] = 0\n elif H[A - 1] < H[B - 1]:\n l[A - 1] = 0\n elif H[A - 1] == H[B - 1]:\n l[A - 1], l[B - 1] = 0, 0\nprint(l.count(1))\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s037275939', 's266487420', 's653619475', 's856976425', 's631958598']
[20032.0, 19876.0, 20124.0, 20132.0, 20120.0]
[48.0, 47.0, 49.0, 244.0, 248.0]
[292, 293, 293, 293, 320]
p02689
u773865844
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["import sys\n\nlines = sys.stdin.readlines()\n\nX = lines[0].split(' ')\nN = int(X[0])\nM = int(X[1])\n\nH = []\nY = [0 for j in range(N)]\nZ =[0]*N\n\nfor i in range(N):\n H.append(lines[1].split(' ')[i])\n\nfor j in range(M):\n A = int(lines[j+2].split(' ')[0])\n B = int(lines[j+2].split(' ')[1])\n if Y[A-1] < int(H[B-1]):\n Y[A-1] = int(H[B-1])\n if Y[B-1] < int(H[A-1]):\n Y[B-1] = int(H[A-1])\n\nprint(1) \n", "import sys\n\nlines = sys.stdin.readlines()\n\nX = lines[0].split(' ')\nN = int(X[0])\nM = int(X[1])\n\nH = []\nY = []*2\n\nfor i in range(N):\n H.append(int(lines[1].split(' ')[i]))\n\nfor j in range(M):\n A = int(lines[j+2].split(' ')[0])\n B = int(lines[j+2].split(' ')[1])\n Y.append([A,B])\n\nY.sort()\n", "import sys\n\nlines = sys.stdin.readlines()\n\nX = lines[0].split(' ')\nN = int(X[0])\nM = int(X[1])\n\nH = []\nY = []\n\nfor i in range(N):\n H.append(int(lines[1].split(' ')[i]))\n\nfor j in range(M):\n A = int(lines[j+2].split(' ')[0])\n B = int(lines[j+2].split(' ')[1])\n if int(H[A-1]) <= int(H[B-1]): \n Y.append(A-1)\n if int(H[B-1]) <= int(H[A-1]):\n Y.append(B-1)\n", "import sys\n\nlines = sys.stdin.readlines()\n\nX = lines[0].split(' ')\nN = int(X[0])\nM = int(X[1])\n\nH = []\nY = []*2\n\nfor i in range(N):\n H.append(int(lines[1].split(' ')[i]))", "import sys\n\nlines = sys.stdin.readlines()\n\nX = lines[0].split(' ')\nN = int(X[0])\nM = int(X[1])\n\nH = []\nY = []\n\nH=lines[1].split(' ')\n\nfor j in range(M):\n A = int(lines[j+2].split(' ')[0])\n B = int(lines[j+2].split(' ')[1])\n if int(H[A-1]) <= int(H[B-1]): \n Y.append(A-1)\n if int(H[B-1]) <= int(H[A-1]):\n Y.append(B-1)\nZ = len(set(Y))\nprint(N-Z)\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s069879505', 's196041272', 's508921901', 's954278659', 's098539220']
[25752.0, 24160.0, 24220.0, 24236.0, 30720.0]
[2206.0, 2206.0, 2206.0, 2206.0, 212.0]
[419, 300, 384, 173, 372]
p02689
u779293207
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M=map(int,input().split())\nH=list(map(int,input().split()))\nc=[]\nd=[]\ne=[]\nf=[]\n\nfor i in range(M):\n A,B=map(int,input().split())\n d.append(A)\n d.append(B)\n if H[A-1]>H[B-1]:\n c.append(A)\n e.append(B)\n elif H[B-1]>H[A-1]:\n c.append(B)\n e.append(A)\n\nfor k in range(1,N+1):\n if (k in c) and (k not in e):\n f.append(k)\n \n\nfor j in range(1,N+1):\n if j not in d:\n f.append(j)\n \n\n \nprint(len(f))\n\n\n\n\nD=set(d)\n\nfor j in range(1,N+1):\n if j not in D:\n c.append(j)\n \nprint(len(set(c)))\n', 'N,M=map(int, input().split())\nH=list(map(int, input().split()))\n\ng = []\nfor i in range(M):\n a, b = map(int, input().split())\n if H[a-1] == H[b-1]:\n g += [a, b]\n if H[a-1] > H[b-1]:\n g += [b]\n else:\n g += [a]\n\ng = set(g)\nr = N - len(g)\nprint(r)\n']
['Wrong Answer', 'Accepted']
['s506671848', 's417628008']
[24904.0, 20116.0]
[2206.0, 266.0]
[520, 277]
p02689
u779389113
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['(N,M) = input().split()\nN = int(N)\nM = int(M)\nh = list(map(int,input().split()))\ny = [0] * N\nfor i in range (M):\n A,B = map(int,input().split())\n if h[A -1] >= h[B -1]:\n y[B -1] += 1\n if h[B -1] >= h[a -1]:\n y[A -1] += 1\nprint(y.count(0))', '(N,M) = input().split()\nN = int(N)\nM = int(M)\nh = list(map(int,input().split()))\ny = [0] * N\nfor i in range (M):\n A,B = map(int,input().split())\n if h[A -1] >= h[B -1]:\n y[B -1] += 1\n if h[B -1] >= h[a -1]:\n y[A -1] += 1\nprint(y.count(0))', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\nc = [0] * N\nfor i in range(M):\n A,B = map(int,input().split())\n if H[A -1] >= H[B -1]:\n c[B - 1] += 1\n if H[B - 1] >= H[A - 1]:\n c[A - 1] += 1\nprint(c.count(0))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s267034980', 's570884485', 's308012983']
[20028.0, 20100.0, 19960.0]
[44.0, 43.0, 279.0]
[261, 261, 249]
p02689
u779728630
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nH = list(map(int, input().split()))\n\nL = [0 for in range(N+1)]\n\nfor q in range(M):\n A, B = map(int, input().split())\n if H[A] < H[B]:\n L[A] += 1\n elif H[A] > H[B]:\n L[B] += 1\n else:\n L[A] += 1\n L[B] += 1\n \nans = 0\nfor i in range(1,N+1):\n if L[i] == 0:\n ans += 1\nprint(ans)\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\n\nL = [0 for i in range(N+1)]\n\nfor q in range(M):\n A, B = map(int, input().split())\n if H[A-1] < H[B-1]:\n L[A] += 1\n elif H[A-1] > H[B-1]:\n L[B] += 1\n else:\n L[A] += 1\n L[B] += 1\n \nans = 0\nfor i in range(1,N+1):\n if L[i] == 0:\n ans += 1\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s909008318', 's105082623']
[9020.0, 20124.0]
[22.0, 265.0]
[329, 339]
p02689
u785266893
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\n\ngood = 0\n\nobs = [[]*n]\n\nfor i in range(m):\n a, b = map(int, input().split())', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\n\ngood = 0\n\nobs = [[] for i in range(n) ]\n\nfor i in range(m):\n a, b = map(int, input().split())\n obs[a-1].append(b)\n obs[b-1].append(a)\n\n higher = True\n if len(o) == 0:\n good += 1\n continue\n o = set(o)\n for i in o:\n if h[idx] <= h[i-1]:\n higher = False\n if higher:\n good += 1\n\nprint(good)\n', '\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\n\ngood = 0\n\nobs = [[] for i in range(n) ]\n\nfor i in range(m):\n a, b = map(int, input().split())\n obs[a-1].append(b)\n obs[b-1].append(a)\n\nfor idx,o in enumerate(obs):\n higher = True\n if len(o) == 0:\n good += 1\n continue\n o = set(o)\n for i in o:\n if h[idx] <= h[i-1]:\n higher = False\n if higher:\n good += 1\n\nprint(good)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s040071428', 's883688675', 's811652650']
[19952.0, 20000.0, 31948.0]
[200.0, 65.0, 410.0]
[150, 420, 449]
p02689
u788452182
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m=map(int,input().split(" "))\nheights=list(map(int,input().split(" ")))\n\nroads=[]\nmountains={}\ntestM=0\nres=0\nways=0\ntemp=0\nsign=False\nfor i in range(m):\n roads.append(list(map(int,input().split(" "))))\nfor j in range(1,n+1):\n if sign:\n res+=1\n sign=True\n for k in range(m):\n if j==roads[k][0]:\n if heights[roads[k][1]-1]>heights[j-1]:\n sign=False\n break\n elif j==roads[k][1]:\n if heights[roads[k][1]-1]>heights[j-1]:\n sign = False\n break\n\nprint(res)\n', 'n,m=map(int,input().split(" "))\nheights=list(map(int,input().split(" ")))\n\nroads=[]\nmountains={}\ntestM=0\nres=0\nways=0\ntemp=0\nsign=False\nfor i in range(m):\n roads.append(list(map(int,input().split(" "))))\nprint(n,m,heights,roads)\nfor j in range(1,n+1):\n if sign:\n print(j-1)\n res+=1\n sign=True\n for k in range(m):\n if j==roads[k][0]:\n if heights[roads[k][1]-1]>heights[j-1]:\n sign=False\n break\n elif j==roads[k][1]:\n if heights[roads[k][1]-1]>heights[j-1]:\n sign = False\n break\n\nprint(res)\n', 'n,m=input().split()\nh_list = []\nh_list = input().split(" ")\nresult =[True]*n\ncount = 0\nfor i in range(int(m)):\n temp1,temp2=input().split()\n if h_list[int(temp1)-1] < h_list[int(temp2)-1]:\n result[int(temp1)-1] = False\n elif h_list[int(temp1)-1] == h_list[int(temp2)-1]:\n result[int(temp1) - 1] = False\n result[int(temp2) - 1] = False\n else:\n result[int(temp2)-1] = False\nfor i in range(int(n)):\n if(result[i]==True):\n count += 1\nprint(count)', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\np = [0 for i in range(n)]\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] >= h[b-1]:\n p[b-1] = -1\n if h[a-1] <= h[b-1]:\n p[a-1] = -1\nprint(p.count(0))']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s371098692', 's454477069', 's594250595', 's801787526']
[31396.0, 35192.0, 16828.0, 20104.0]
[2206.0, 2210.0, 35.0, 256.0]
[570, 614, 492, 253]
p02689
u790012205
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nH = list(map(int, input().split()))\nHeight = []\nGood = []\nfor i in range(N):\n Height.append(H[i])\n Good.append(0)\nfor i in range(M):\n A, B = map(int, input().split())\n if Height[A - 1] < Height[B - 1]:\n Good[A - 1] = 1\n if Height[A - 1] > Height[B - 1]:\n Good[B - 1] = 1\n else:\n Good[A - 1] = 1\n Good[B - 1] = 1\nn = 0\nfor i in range(N):\n if Good[i] == 0:\n n += 1\nprint(n)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nHeight = []\nGood = []\nfor i in range(N):\n Height.append(H[i])\n Good.append(0)\nfor i in range(M):\n A, B = map(int, input().split())\n if Height[A - 1] < Height[B - 1]:\n Good[A - 1] = 1\n elif Height[A - 1] > Height[B - 1]:\n Good[B - 1] = 1\n else:\n Good[A - 1] = 1\n Good[B - 1] = 1\nn = 0\nfor i in range(N):\n if Good[i] == 0:\n n += 1\nprint(n)']
['Wrong Answer', 'Accepted']
['s236367735', 's272442133']
[20116.0, 20120.0]
[303.0, 271.0]
[460, 462]
p02689
u804711544
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = [int(_) for _ in input().split()]\n\nelevation = {}\nfor _ in range(len(h)):\n elevation[_+1] = h[_]\n\nobs = list([] for _ in range(len(h)))\nfor i in range(m):\n obsA, obsB = map(int, input().split())\n if elevation[obsA] == elevation[obsB]: \n obs[obsA-1].append(1) # 1==True, 0==False\n obs[obsB-1].append(1)\n elif elevation[obsA] > elevation[obsB]:\n obs[obsA-1].append(1)\n obs[obsB-1].append(0)\n elif elevation[obsA] < elevation[obsB]:\n obs[obsA-1].append(0)\n obs[obsB-1].append(1)\n\ncount = 0\nfor o in obs: \n if all(o): \n count += 1\n\nprint(count)\nprint(elevation)\nprint(obs)', 'n, m = map(int, input().split())\nh = [int(_) for _ in input().split()]\n\nelevation = {}\nfor _ in range(len(h)):\n elevation[_+1] = h[_]\n\nobs = list([] for _ in range(len(h)))\nfor i in range(m):\n obsA, obsB = map(int, input().split())\n if elevation[obsA] == elevation[obsB]: \n obs[obsA-1].append(0) # 1==True, 0==False\n obs[obsB-1].append(0)\n elif elevation[obsA] > elevation[obsB]:\n obs[obsA-1].append(1)\n obs[obsB-1].append(0)\n elif elevation[obsA] < elevation[obsB]:\n obs[obsA-1].append(0)\n obs[obsB-1].append(1)\n\ncount = 0\nfor o in obs: \n if all(o): \n count += 1\n\nprint(count)\nprint(elevation)\nprint(obs)', 'n, m = map(int, input().split())\nh = [int(_) for _ in input().split()]\n\nelevation = {}\nfor _ in range(len(h)):\n elevation[_+1] = h[_]\n\nobs = list([] for _ in range(len(h)))\nfor i in range(m):\n obsA, obsB = map(int, input().split())\n if elevation[obsA] == elevation[obsB]: \n obs[obsA-1].append(0) # 1==True, 0==False\n obs[obsB-1].append(0)\n elif elevation[obsA] > elevation[obsB]:\n obs[obsA-1].append(1)\n obs[obsB-1].append(0)\n elif elevation[obsA] < elevation[obsB]:\n obs[obsA-1].append(0)\n obs[obsB-1].append(1)\n\ncount = 0\nfor o in obs: \n if all(o): \n count += 1\n\nprint(count)\n# print(elevation)\n# print(obs)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s122734168', 's598248385', 's424771326']
[34940.0, 34800.0, 31708.0]
[475.0, 464.0, 435.0]
[836, 836, 840]
p02689
u805011545
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import numpy as np\nN, M = [int(x) for x in input().split()]\nH = [float(x) for x in input().split()]\nAB = [[int(x) for x in input().split()] for _ in range(M)]\n\ngraph = np.zeros((N,N))\nfor A, B in AB:\n graph[A-1][B-1] = 1\n graph[B-1][A-1] = 1\n\nans = 0\nfor i in range(N):\n h = 0\n for j in range(N):\n if(graph[i][j]!=0):\n if(H[i]<=H[j]):\n h += 1\n if(h==0):\n ans += 1', 'import numpy as np\nN, M = [int(x) for x in input().split()]\nH = [float(x) for x in input().split()]\nAB = [[int(x) for x in input().split()] for _ in range(M)]\n\ngraph = np.zeros((N,N))\nfor A, B in AB:\n graph[A-1][B-1] = 1\n graph[B-1][A-1] = 1\n\nans = 0\nfor i in range(N):\n for j in range(N):\n h = 0\n if(graph[i][j]!=0):\n if(H[i]<=H[j]):\n h += 1\n if(h==0):\n ans += 1\nprint(ans)', 'import numpy as np\nN, M = [int(x) for x in input().split()]\nH = [float(x) for x in input().split()]\nAB = [[int(x) for x in input().split()] for _ in range(M)]\n\nmax_h = [0 for _ in range(N)]\n\nfor A, B in AB:\n max_h[A-1] = max(max_h[A-1], H[B-1])\n max_h[B-1] = max(max_h[B-1], H[A-1])\n\nans = 0\nfor i in range(N):\n if(H[i]>max_h[i]):\n ans += 1\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s287993979', 's465698575', 's828217663']
[48168.0, 48208.0, 48872.0]
[322.0, 319.0, 422.0]
[386, 399, 357]
p02689
u809816772
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nH = list(map(int, input().split())) \nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n A[i] -= 1\n B[i] -= 1\nlis = []\nfor i in range(M):\n if H[A[i]] < H[B[i]]:\n min.append(A[i])\n if H[A[i]] == H[B[i]]:\n min.append(A[i])\n min.append(B[i])\n if H[A[i]] > H[B[i]]:\n min.append(B[i])\nprint(len(set(lis)))', 'N, M = map(int, input().split())\nH = list(map(int, input().split())) \nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n A[i] -= 1\n B[i] -= 1\nlis = [0]*N\nfor i in range(M):\n if H[A[i]] >= H[B[i]]:\n lis[B[i]] = 1\n if H[A[i]] <= H[B[i]]:\n lis[A[i]] = 1\n \n print(lis.count(0))', 'N, M = map(int, input().split())\nH = list(map(int, input().split())) \nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n A[i] -= 1\n B[i] -= 1\nlis = [0]*N\nfor i in range(M):\n if H[A[i]] >= H[B[i]]:\n lis[B[i]] = -1\n if H[A[i]] <= H[B[i]]:\n lis[A[i]] = -1\n \n print(lis.count(0))', 'N, M = map(int, input().split())\nH = list(map(int, input().split())) \nA = [0]*M\nB = [0]*M\n\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n A[i] -= 1\n B[i] -= 1\n\nlis = [0]*N\n\nfor i in range(M):\n if H[A[i]] >= H[B[i]]:\n lis[B[i]] = -1\n if H[A[i]] <= H[B[i]]:\n lis[A[i]] = -1\n \n\nprint(lis.count(0))']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s056481471', 's379592650', 's512476546', 's894681417']
[20972.0, 21968.0, 21840.0, 21692.0]
[225.0, 2206.0, 2206.0, 307.0]
[407, 337, 339, 339]
p02689
u810356688
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["import sys\ndef input(): return sys.stdin.readline().rstrip()\ndef main():\n n,m=map(int,input().split())\n H=[int(_) for _ in input().split()]\n HH= [0]*n\n\n for i in range(m):\n a,b=map(int,input().split())\n HH[a-1]=max(HH[a-1],H[b-1])\n HH[b-1]=max(HH[b-1],H[a-1])\n ans=0\n for i,hh in enumerate(HH):\n if H[i]>hh or hh==0:\n ans+=1\n print(HH)\n print(ans)\n\nif __name__=='__main__':\n main()", "import sys\ndef input(): return sys.stdin.readline().rstrip()\ndef main():\n n,m=map(int,input().split())\n H=[int(_) for _ in input().split()]\n HH= [0]*n\n\n for i in range(m):\n a,b=map(int,input().split())\n HH[a-1]=max(HH[a-1],H[b-1])\n HH[b-1]=max(HH[b-1],H[a-1])\n ans=0\n for i,hh in enumerate(HH):\n if H[i]>hh or hh==0:\n ans+=1\n print(ans)\n\nif __name__=='__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s095563559', 's538911161']
[19996.0, 20124.0]
[241.0, 216.0]
[447, 433]
p02689
u811068179
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import collections\nn,m = (int(i) for i in input().split())\nh = [int(i) for i in input().split()]\nab =[[0]]*n\nprint(ab)\nfor _ in range(m):\n\ta,b = (int(i) for i in input().split())\n\tif h[a-1]-h[b-1]>0:\n\t\tab[b-1]=["a"]\n\n\telif h[a-1]-h[b-1]<0:\n\t\tab[a-1]=["a"]\n\n\telse:\n\t\tab[a-1]=["a"]\n\t\tab[b-1]=["a"]\n\n\nprint(ab.count([0]))', 'import collections\nn,m = (int(i) for i in input().split())\nh = [int(i) for i in input().split()]\nab =[[0]]*n\n\nfor _ in range(m):\n\ta,b = (int(i) for i in input().split())\n\tif h[a-1]-h[b-1]>0:\n\t\tab[b-1]=["a"]\n\n\telif h[a-1]-h[b-1]<0:\n\t\tab[a-1]=["a"]\n\n\telse:\n\t\tab[a-1]=["a"]\n\t\tab[b-1]=["a"]\n\n\nprint(ab.count([0]))']
['Wrong Answer', 'Accepted']
['s677788718', 's461957317']
[20576.0, 20480.0]
[372.0, 326.0]
[318, 309]
p02689
u815304751
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import numpy as np\nn,m = list(map(int,input().split()))\nh_ = list(map(int,input().split()))\na_ = [list(map(int,input().split())) for i in range(m)]\n\nres = np.arange(2,n)\nres = res.tolist()\nfor i in range(m):\n if(h_[a_[i][0] - 1] < h_[a_[i][1] - 1]):\n if(a_[i][0] in res):\n res.remove(a_[i][0])\n elif(h_[a_[i][0] - 1] > h_[a_[i][1] - 1]):\n if(a_[i][1] in res):\n res.remove(a_[i][1])\n else:\n if(a_[i][0] in res):\n res.remove(a_[i][0])\n if(a_[i][1] in res):\n res.remove(a_[i][1])\n\nprint(len(res))\n', 'n,m = list(map(int,input().split()))\nh_ = list(map(int,input().split()))\na_ = [list(map(int,input().split())) for i in range(m)]\n\nresList = []\nfor i in range(m):\n\n if(h_[a_[i][0] -1] > h_[a_[i][1] -1]):\n res = a_[i][0]\n res_not = a_[i][1]\n elif(h_[a_[i][0] -1] < h_[a_[i][1] -1]):\n res = a_[i][1]\n res_not = a_[i][0]\n else:\n continue\n\n if(res in resList):\n continue\n else:\n resList.append(res)\n\n if(res_not in resList):\n resList.remove(res_not)\n else:\n continue\n\nprint(resList)\n', 'n,m = map(int,input().split())\nh=[]\nh.extend(input().split())\nh=list(map(int,h))\ncnt = [0]*n\ncnt2 = [0]*n\nans = 0\n\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] > h[b-1]:\n cnt[a-1] += 1 \n if h[a-1] < h[b-1]:\n cnt[b-1] +=1\n cnt2[a-1] +=1\n cnt2[b-1] +=1\n\nfor p in range(n):\n if cnt[p]==cnt2[p]:\n ans += 1\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s406107980', 's407638185', 's571222400']
[54232.0, 31520.0, 20056.0]
[2207.0, 2206.0, 298.0]
[575, 562, 346]
p02689
u815763296
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nHList = []\nansList=[]\nfor H in input().split():\n HList.append(H)\n ansList.append(1)\n\nprint(ansList)\n\nfor i in range(M):\n A, B = map(int, input().split())\n if HList[A-1] > HList[B-1]:\n ansList[B-1] = 0\n elif HList[A-1] < HList[B-1]:\n ansList[A-1] = 0\n elif HList[A-1] == HList[B-1]:\n ansList[A-1] = 0\n ansList[B-1] = 0\n\nprint(ansList.count(1))\n', "N, M = map(int, input().split(' '))\nans = [1]*N\nH = list(map(int, input().split(' ')))\n\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] > H[B-1]:\n ans[B-1] = 0\n elif H[A-1] < H[B-1]:\n ans[A-1] = 0\n else:\n ans[A-1] = 0\n ans[B-1] = 0\n\nprint(ans.count(1))\n"]
['Wrong Answer', 'Accepted']
['s782850181', 's149696904']
[19356.0, 20812.0]
[266.0, 242.0]
[422, 309]
p02689
u819465503
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["import random\nimport collections\n# num_list = [10**5, 10**4]\n\n# way_list = [[random.randint(1, 10**5), random.randint(1, 10**5)] for i in range(10**4)]\n\nnum_list = [int(i) for i in input().split()]\nheight_list = [int(i) for i in input().split()]\nway_list = list(list(map(int, input().split())) for i in range(num_list[1]))\n\ntower_list = [i for i in range(1, num_list[0]+1)]\ngd_dict = dict(zip(tower_list, ['good' for i in range(10**5)]))\n\ndef change_to_bad(target_list):\n if height_list[target_list[0]-1] > height_list[target_list[1]-1]:\n gd_dict[target_list[1]] = 'bad'\n elif height_list[target_list[0]-1] == height_list[target_list[1]-1]:\n gd_dict[target_list[0]] = 'bad'\n gd_dict[target_list[1]] = 'bad'\n else:\n gd_dict[target_list[0]] = 'bad'\n\nfor i in way_list:\n change_to_bad(i)\n\ngood_val = collections.Counter(gd_dict.values())['good']\n\ngood_val", "import collections\nnum_list = [int(i) for i in input().split()]\nheight_list = [int(i) for i in input().split()]\nway_list = list(list(map(int, input().split())) for i in range(num_list[1]))\n\ntower_list = [i for i in range(1, num_list[0]+1)]\ngd_dict = dict(zip(tower_list, ['good' for i in range(10**5)]))\n\ndef change_to_bad(target_list):\n if height_list[target_list[0]] > height_list[target_list[1]]:\n gd_dict[target_list[1]] = 'bad'\n elif height_list[target_list[0]] == height_list[target_list[1]]:\n gd_dict[target_list[0]] = 'bad'\n gd_dict[target_list[1]] = 'bad'\n else:\n gd_dict[target_list[0]] = 'bad'\n\nfor i in way_list:\n change_to_bad(i)\n\ngood_val = collections.Counter(gd_dict.values())['good']\n\ngood_val", "import collections\nnum_list = [int(i) for i in input().split()]\nheight_list = [int(i) for i in input().split()]\nway_list = list(list(map(int, input().split())) for i in range(num_list[1]))\n\ntower_list = [i for i in range(1, num_list[0]+1)]\ngd_dict = dict(zip(tower_list, ['good' for i in range((len(tower_list)))]))\n\ndef change_to_bad(target_list):\n if height_list[target_list[0]-1] > height_list[target_list[1]-1]:\n gd_dict[target_list[1]] = 'bad'\n elif height_list[target_list[0]-1] == height_list[target_list[1]-1]:\n gd_dict[target_list[0]] = 'bad'\n gd_dict[target_list[1]] = 'bad'\n else:\n gd_dict[target_list[0]] = 'bad'\n\nfor i in way_list:\n change_to_bad(i)\n\ngood_val = collections.Counter(gd_dict.values())['good']\n\nprint(good_val)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s023043993', 's284392127', 's925407883']
[45236.0, 45072.0, 44932.0]
[334.0, 329.0, 331.0]
[962, 750, 777]
p02689
u833738197
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nheight = list(map(int,input().split()))\nlower_list = []\nfor i in range(m):\n r = list(map(int,input().split()))\n if height[r[0]-1] > height[r[1]-1]:\n lower_list.append(r[1])\n elif height[r[0]-1] < height[r[1]-1]:\n lower_list.append(r[0],r[1])\n else:\n lower_list.append(r[0])\ncount = len(set(lower_list))\nprint(n-count)', 'n,m = map(int,input().split())\nheight = list(map(int,input().split()))\nlower_list = []\nfor i in range(m):\n r = list(map(int,input().split()))\n if height[r[0]-1] > height[r[1]-1]:\n lower_list.append(r[1])\n elif:\n lower_list.append(r[0],r[1])\n else:\n lower_list.append(r[0])\ncount = len(set(lower_list))\nprint(n-count)', 'n,m = map(int,input().split())\nheight = list(map(int,input().split()))\nlower_list = []\nfor i in range(m):\n r = list(map(int,input().split()))\n if height[r[0]-1] > height[r[1]-1]:\n lower_list.append(r[1])\n elif height[r[0]-1] == height[r[1]-1]:\n lower_list.append(r[0])\n lower_list.append(r[1])\n else:\n lower_list.append(r[0])\ncount = len(set(lower_list))\nprint(n-count)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s490462990', 's642068287', 's833170718']
[20120.0, 9048.0, 20108.0]
[46.0, 21.0, 284.0]
[381, 349, 409]
p02689
u836284844
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['def solve(height, road):\n graph = collections.defaultdict(set)\n for a, b in road:\n graph[a].add(b)\n graph[b].add(a)\n ans = 0\n no_good = set()\n for k in graph:\n for nei in graph[k]:\n if height[nei-1] >= height[k-1]:\n no_good.add(k)\n return len(height) - len(no_good)\n\nobs, k = map(int, input().split())\nheight = list(map(int, input().split()))\nroad = []\nfor _ in range(k):\n r = list(map(int, input().split()))\n road.append(r)\nprint(solve(height, road))\n', 'import collections\n\ndef solve(height, road):\n graph = collections.defaultdict(set)\n for a, b in road:\n graph[a].add(b)\n graph[b].add(a)\n ans = 0\n no_good = set()\n for k in graph:\n for nei in graph[k]:\n if height[nei-1] >= height[k-1]:\n no_good.add(k)\n return len(height) - len(no_good)\n\nobs, k = map(int, input().split())\nheight = list(map(int, input().split()))\nroad = []\nfor _ in range(k):\n r = list(map(int, input().split()))\n road.append(r)\nprint(solve(height, road))\n']
['Runtime Error', 'Accepted']
['s031260941', 's067812297']
[31152.0, 59496.0]
[259.0, 518.0]
[524, 544]
p02689
u838644735
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["def main():\n N, M, *HAB = map(int, open(0).read().split())\n H = [0]*N\n for i in range(N):\n H[i] = HAB[i]\n A, B = [0]*M, [0]*M\n for i in range(M):\n A[i] = HAB[N + 2 * i + 0] - 1\n B[i] = HAB[N + 2 * i + 1] - 1\n \n ans = set()\n for i in range(M):\n a = A[i]\n b = B[i]\n ha = H[a]\n hb = H[b]\n if ha < hb:\n ans.add(a)\n elif hb < ha\n ans.add(b)\n print(N - len(ans))\n\nif __name__ == '__main__':\n main()\n", "def main():\n N, M, *HAB = map(int, open(0).read().split())\n H = [0]*N\n for i in range(N):\n H[i] = HAB[i]\n A, B = [0]*M, [0]*M\n for i in range(M):\n A[i] = HAB[N + 2 * i + 0] - 1\n B[i] = HAB[N + 2 * i + 1] - 1\n \n ans = set()\n for i in range(M):\n a = A[i]\n b = B[i]\n ha = H[a]\n hb = H[b]\n if ha < hb:\n ans.add(a)\n elif hb < ha:\n ans.add(b)\n else:\n ans.add(a)\n ans.add(b)\n print(N - len(ans))\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Accepted']
['s480273527', 's216008929']
[9072.0, 44108.0]
[25.0, 165.0]
[530, 591]
p02689
u838959206
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\narr = [0] + list(map(int,input().split()))\n\ng = [[] for _ in range(N+1)]\nfor _ in range(M):\n A, B = map(int,input().split())\n g[A].append(B)\n g[B].append(A)\nans = 0\nfor v in range(1,N+1):\n for u in g[v]:\n if arr[u]>=arr[v]:\n break\n else:\n ans+=1\nprint(ans)', 'N, M = map(int, input().split())\narr = [0] + list(map(int,input().split()))\n\ng = [[] for _ in range(N+1)]\nprint(arr)\nprint (g)\nfor _ in range(M):\n A, B = map(int,input().split())\n g[A].append(B)\n g[B].append(A)\nprint (g)\nans = 0\nfor v in range(1,N+1):\n for u in g[v]:\n if arr[u]>=arr[v]:\n break\n else:\n ans+=1\nprint(ans)', 'n,m=map(int,input().split())\narr=[0]+list(map(int,input().split()))\ng=[[] for _ in range(n+1)]\nfor _ in range(m):\n a,b=map(int,input().split())\n g[a].append(b)\n g[b].append(a)\nans=0\nfor v in range(1,n+1):\n for u in g[v]:\n if arr[u]>=arr[v]:\n break\n else:\n ans+=1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s429721041', 's857944100', 's501119232']
[29384.0, 33572.0, 29428.0]
[355.0, 433.0, 364.0]
[365, 396, 289]
p02689
u845847173
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = []\nfor i range(m):\n a, b = map(int, input().split())\n l.append([a, b])\n\nll = [0]*n\n\nfor j in l:\n if h[j[0] - 1] > h[j[1] - 1]:\n ll[j[1] - 1] += 1\n elif h[j[0] - 1] > h[j[1] - 1]:\n ll[j[1] - 1] += 1\n ll[j[0] - 1] += 1\n else:\n ll[j[0] - 1] += 1\n\nans = 0\n\nfor k in ll:\n if k == 0:\n ans += 1\n else:\n ans += 0\n \nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = []\nfor i range(m):\n a, b = map(int, input().split())\n l.append([a, b])\n\nll = [0]*n\n\nfor j in l:\n if h[j[0] - 1] > h[j[1] - 1]:\n ll[j[1] - 1] += 1\n elif h[j[0] - 1] == h[j[1] - 1]:\n ll[j[1] - 1] += 1\n ll[j[0] - 1] += 1\n else:\n ll[j[0] - 1] += 1\n\nans = 0\n\nfor k in ll:\n if k == 0:\n ans += 1\n else:\n ans += 0\n \nprint(ans)', 'import copy\n\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = []\nfor i range(m):\n a, b = map(int, input().split())\n l.append([a, b])\n\nll = [0]*n\n\nfor j in l:\n if h[j[0] - 1] > h[j[1] - 1]:\n ll[j[1] - 1] += 1\n elif h[j[0] - 1] == h[j[1] - 1]:\n ll[j[1] - 1] += 1\n ll[j[0] - 1] += 1\n else:\n ll[j[0] - 1] += 1\n\nans = 0\n\nfor k in ll:\n if k == 0:\n ans += 1\n else:\n ans += 0\n \nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = []\nfor i range (m):\n a, b = map(int, input().split())\n l.append([a, b])\n\nll = [0]*n\n\nfor j in l:\n if h[j[0] - 1] > h[j[1] - 1]:\n ll[j[1] - 1] += 1\n elif h[j[0] - 1] > h[j[1] - 1]:\n ll[j[1] - 1] += 1\n ll[j[0] - 1] += 1\n else:\n ll[j[0] - 1] += 1\n\nans = 0\n\nfor k in ll:\n if k == 0:\n ans += 1\n else:\n ans += 0\n \nprint(ans)', 'import copy\n\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = []\nfor i in range(m):\n a, b = map(int, input().split())\n l.append([a, b])\n\nll = [0]*n\n\nfor j in l:\n if h[j[0] - 1] > h[j[1] - 1]:\n ll[j[1] - 1] += 1\n elif h[j[0] - 1] == h[j[1] - 1]:\n ll[j[1] - 1] += 1\n ll[j[0] - 1] += 1\n else:\n ll[j[0] - 1] += 1\n\nans = 0\n\nfor k in ll:\n if k == 0:\n ans += 1\n else:\n ans += 0\n \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s281124711', 's685396392', 's939319927', 's967851204', 's358392996']
[8908.0, 8920.0, 8936.0, 8920.0, 28996.0]
[24.0, 22.0, 21.0, 24.0, 317.0]
[456, 457, 470, 457, 473]
p02689
u849341325
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['\nN, M = map(int,input().split())]\n\nH = [0] + list(map(int,input().split()))\n\npath = {}\nfor i in range(1,N+1):\n\tpath[i] = {}\n\nfor i in range(1,M+1):\n\tA, B = map(int,input().split())\n\tpath[A].add(B)\n\tpath[B].add(A)\n\ncount = 0\n\nfor i in range(1,N+1)\n\tif H[i] > max(H[j] for j in path[i]):\n\t\tcount += 1\n\t\nprint(count)', '\nN, M = map(int,input().split())\n\nH = [0] + list(map(int,input().split()))\n\npath = [0]\nfor i in range(1,N+1):\n\tpath.append([])\n\nfor i in range(1,M+1):\n\tA, B = map(int,input().split())\n\tpath[A].append(B)\n\tpath[B].append(A)\n\ncount = 0\n\nfor i in range(1,N+1):\n\tif len(path[i]) == 0:\n\t\tcount += 1\n\telif H[i] > max(H[j] for j in path[i]):\n\t\tcount += 1\n\t\nprint(count)']
['Runtime Error', 'Accepted']
['s866752087', 's684497506']
[9008.0, 29316.0]
[22.0, 428.0]
[313, 361]
p02689
u851704997
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M = map(int,input().split())\nH = list(map(int,input().split()))\nList = []\nfor k in range(1,N+1):\n List.append(k)\nfor i in range(M):\n A,B = map(int,input().split())\n tmpA = H[A-1]\n tmpB = H[B-1]\n if(tmpA < tmpB):\n if(A in List == True):\n List.remove(A)\n elif(tmpA > tmpB):\n if(B in List == True):\n List.remove(B)\n else:\n if(A in List == True):\n List.remove(A)\n if(B in List == True):\n List.remove(B)\nprint(str(len(List)))', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\nList = [0]*N\nfor i in range(M):\n A,B = map(int,input().split())\n if(H[A-1] > H[B-1]):\n List[B-1] = 1\n elif(H[A-1] < H[B-1]):\n List[A-1] = 1\n else:\n List[A-1] = 1\n List[B-1] = 1\nprint(str(List.count(0)))']
['Wrong Answer', 'Accepted']
['s341922040', 's649646157']
[20144.0, 19952.0]
[2206.0, 259.0]
[461, 308]
p02689
u857293613
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import numpy as np\nn, m = map(int, input().split())\nhlis = list(map(int, input().split()))\nroad = []\nfor i in range(m):\n a, b = map(int, input().split())\n road.append([a, b])\ntable = [0]*n\nans = 0\nfor i in range(n):\n if table[i] == 0:\n rival = []\n for j in road:\n if j[0] == i+1:\n rival.append(j[1]-1)\n elif j[1] == i+1:\n rival.append(j[0]-1)\n if hlis[i] == max([hlis[q] for q in rival]+[hlis[i]]) and [hlis[q] for q in rival].count(hlis[i])== 0:\n table[i] = 1\n ans += 1\n for q in rival:\n table[q] = -1 \n else:\n table[i] = -1\nprint(ans, table)', 'import sys\nn, m = map(int, input().split())\nhlis = list(map(int, input().split()))\nroad = []\nfor i in range(m):\n a, b = map(int, input().split())\n road.append([a, b])\ntable = [0]*n\nans = 0\nfor i in range(n):\n if table[i] != 0:\n \tbreak\n else:\n rival = []\n for j in road:\n if j[0] == i+1:\n if hlis[j[1]-1] <= hlis[i]:\n table[j[1]-1] = -1\n else:\n table[i] = -1\n break\n elif j[1] == i+1:\n if hlis[j[0]-1] <= hlis[i]:\n table[j[0]-1] = -1\n else:\n table[i] = -1\n break\n table[i] = 1\n ans += 1\n \nprint(ans)', 'import numpy as np\nn, m = map(int, input().split())\nhlis = list(map(int, input().split()))\nroad = []\nfor i in range(m):\n a, b = map(int, input().split())\n road.append([a, b])\ntable = [0]*n\nans = 0\nfor i in range(n):\n print(type(i))\n if table[i] == 0:\n rival = []\n for j in road:\n if j[0] == i:\n rival.append(j[1])\n elif j[1] == i:\n rival.append(j[0])\n if hlis[i] == max([hlis[q-1] for q in rival]+[hlis[i]]):\n table[i] = 1\n ans += 1\n for q in rival:\n table[q-1] = -1 \n else:\n table[i] = -1\nprint(ans)', 'n, m = map(int, input().split())\nhlis = list(map(int, input().split()))\nlis = [1]*n\nfor i in range(m):\n a, b = map(int, input().split())\n if hlis[a-1] > hlis[b-1]:\n lis[b-1] = -1\n elif hlis[a-1] < hlis[b-1]:\n lis[a-1] = -1\n elif hlis[a-1] == hlis[b-1]:\n lis[a-1] = -1\n lis[b-1] = -1\nprint(lis.count(1))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s008373493', 's575727405', 's987096142', 's070043485']
[47368.0, 28956.0, 47276.0, 20044.0]
[2207.0, 2206.0, 2207.0, 240.0]
[691, 746, 651, 342]
p02689
u858196335
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M = map(int, input().split())\n\ngoodObservatory = [1]*N\nH = []\nH = input()\n\nfor i in range(M):\n\tA,B = map(int, input().split())\n\tif H[A-1] > H[B-1]:\n\t\tgoodObservatory[B-1] = 0\n\telif H[A-1] < H[B-1]:\n\t\tgoodObservatory[A-1] = 0\n\telif H[A-1] == H[B-1]:\n\t\tgoodObservatory[A-1] = 0\n\t\tgoodObservatory[B-1] = 0\n\nprint(sum(goodObservatory))', 'N,M = map(int, input().split())\n\ngoodObservatory = [1]*N\n\nH = list(map(int, input().split()))\n\nfor i in range(M):\n\tA,B = map(int, input().split())\n\tif H[A-1] > H[B-1]:\n\t\tgoodObservatory[B-1] = 0\n\telif H[A-1] < H[B-1]:\n\t\tgoodObservatory[A-1] = 0\n\telif H[A-1] == H[B-1]:\n\t\tgoodObservatory[A-1] = 0\n\t\tgoodObservatory[B-1] = 0\n\nprint(sum(goodObservatory))']
['Wrong Answer', 'Accepted']
['s227393861', 's152591626']
[11776.0, 20816.0]
[221.0, 254.0]
[333, 351]
p02689
u861141787
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\n \nedeg = [[] for _ in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1; b -= 1\n edeg[a].append(b)\n edeg[b].append(a)\n \n#print(edeg)\n\nans = 0\nfor node in range(n):\n good = True\n for neigber in edeg[node]:\n #print("neigber:", neigber)\n if h[node] <= h[neigber]:\n good = False\n if good:\n ans += 1 \n\nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\n \nedeg = [[] for _ in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1; b -= 1\n edeg[a].append(b)\n edeg[b].append(a)\n \n#print(edeg)\n\nans = 0\nfor node in range(n):\n good = True\n for neigber in edeg[node]:\n print("neigber:", neigber)\n if h[node] <= h[neigber]:\n good = False\n if good:\n ans += 1 \n\nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\n \nedeg = [[] for _ in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1; b -= 1\n edeg[a].append(b)\n edeg[b].append(a)\n \n#print(edeg)\n\nans = 0\nfor node in range(n):\n good = True\n for neigber in edeg[node]:\n #print("neigber:", neigber)\n if h[node] <= h[neigber]:\n good = False\n if good:\n ans += 1 \n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s070992875', 's320299472', 's307015585']
[29452.0, 29300.0, 29428.0]
[396.0, 478.0, 380.0]
[458, 457, 450]
p02689
u861886710
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = list(map(int, input().split()))\narr=[0]+list(map(int,input().split()))\ng = [[] for _ in range(n+1)]\nprint(g)\nfor _ in range(m):\n a, b = map(int, input().split())\n g[a].append(b)\n g[b].append(a)\nprint(g)\nans = 0\nfor v in range(1, n+1):\n \n for u in g[v]:\n if arr[u]>=arr[v]:\n break\n \n else:\n ans += 1\nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\ncnt = [0] * n\nchk = [0] * n\nans = 0\n\nfor i in range(m):\n a,b = map(int, input().split())\n if h[a-1] > h[b-1]:\n cnt[a-1] += 1\n\n if h[a-1] < h[b-1]:\n chk[b-1] += 1\n chk[a-1] += 1\n chk[b-1] += 1\nprint(cnt)\nprint(chk)\nfor i in range(n):\n if cnt[i] == chk[i]:\n ans += 1\n\nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\ncnt = [0] * n\nchk = [0] * n\nans = 0\n\nfor i in range(m):\n a,b = map(int, input().split())\n if h[a-1] > h[b-1]:\n cnt[a-1] += 1\n\n if h[a-1] < h[b-1]:\n cnt[b-1] += 1\n chk[a-1] += 1\n chk[b-1] += 1\nprint(cnt)\nprint(chk)\nfor i in range(n):\n if cnt[i] == chk[i]:\n ans += 1\n\nprint(ans)', 'n,m=map(int,input().split())\narr=[0]+list(map(int,input().split()))\ng=[[] for _ in range(n+1)]\nfor _ in range(m):\n a,b=map(int,input().split())\n g[a].append(b)\n g[b].append(a)\nans=0\nfor v in range(1,n+1):\n for u in g[v]: \n if arr[u]>=arr[v]:\n break\n else: \n ans+=1\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s076616275', 's558415977', 's784428688', 's805989400']
[33456.0, 19956.0, 20064.0, 29468.0]
[399.0, 313.0, 312.0, 361.0]
[591, 384, 384, 499]
p02689
u863433366
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [[] for _ in range(n)]\ncheck = [False for _ in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n ab[a-1].append(b)\n ab[b-1].append(a)\n\nfor j in range(n):\n for k in ab[j]:\n if k < h[j]:\n check[j] = True\n elif k > h[j]:\n check[j] = False\n\telse:\n check[j] = False\n\nprint(check.count(True))', 'n, m = map(int, input().split())\nh = [0] + list(map(int, input().split()))\nab = [[] for _ in range(n+1)]\ncount = 0\nfor i in range(m):\n a, b = map(int, input().split())\n ab[a].append(b)\n ab[b].append(a)\n\nfor j in range(1,n+1):\n for k in ab[j]:\n if h[j] <= h[k]:\n break\n else: \n count += 1\n \nprint(count)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [[] for _ in range(n)]\ncheck = [False for _ in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n ab[a-1].append(b)\n ab[b-1].append(a)\n\nfor j in range(n):\n for k in ab[j]:\n if h[j] <= h[k]:\n check[j] = True\n \nprint(check.count(True))', 'n,m=map(int,input().split())\nh=[0]+list(map(int, input().split()))\nroads=[[] for _ in range(n+1)]\ncnt=0\nfor i in range(m):\n a,b=map(int,input().split())\n roads[a].append(b)\n roads[b].append(a)\n \nfor i in range(1,n+1):\n for j in roads[i]:\n if h[i]<=h[j]:\n break\n else:\n cnt+=1\n \nprint(cnt', 'n, m = map(int, input().split())\nh = [0] + list(map(int, input().split()))\nab = [[] for _ in range(n+1)]\ncheck = [False for _ in range(n+1)]\nfor i in range(m):\n a, b = map(int, input().split())\n ab[a-1].append(b)\n ab[b-1].append(a)\n\nfor j in range(1,n+1):\n for k in ab[j]:\n if h[j] <= h[k]:\n check[k] = True\n \nprint(check.count(True))', 'n,m=map(int,input().split())\nh=[0]+list(map(int, input().split()))\nroads=[[] for _ in range(n+1)]\ncnt=0\nfor i in range(m):\n a,b=map(int,input().split())\n roads[a].append(b)\n roads[b].append(a)\n\nfor i in range(1,n+1):\n for j in roads[i]:\n if h[i]<=h[j]:\n break\n else:\n cnt+=1\n \nprint(cnt)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s361842035', 's736610485', 's746638236', 's764463843', 's919315740', 's754622104']
[8908.0, 29276.0, 30224.0, 9028.0, 30168.0, 29404.0]
[25.0, 358.0, 353.0, 24.0, 376.0, 365.0]
[399, 328, 337, 331, 351, 331]
p02689
u863964720
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M = map( int ,input().split())\nH = list(map( int , input().split()))\nA_B = [[0] * 2 for i in range(M)]\nJ = [0]*N\nfor i in range(M):\n A,B = map( int ,input().split())\n A_B[i][0] = A\n A_B[i][1] = B\nfor j in range(M):\n if H[A_B[j][0]-1] > H[A_B[j][1]-1]:\n if J[A_B[j][0]-1] != -1:\n J[A_B[j][0]-1] = 1\n J[A_B[j][1]-1] =-1\n elif H[A_B[j][0]-1] < H[A_B[j][1]-1]:\n if J[A_B[j][1]-1] != -1:\n J[A_B[j][0]-1] = 1\n J[A_B[j][1]-1] = 1\n else:\n J[A_B[j][0]-1] =-1\n J[A_B[j][1]-1] =-1\nfor l in range(N):\n if J[l] == 0:\n J[l] = 1\nprint(J.count(1))', 'N,M = map( int ,input().split())\nH = list(map( int , input().split()))\nA_B = [[0] * 2 for i in range(M)]\nJ = [0]*N\nfor i in range(M):\n A,B = map( int ,input().split())\n A_B[i][0] = A\n A_B[i][1] = B\nfor j in range(M):\n if H[A_B[j][0]-1] > H[A_B[j][1]-1]:\n if J[A_B[j][0]-1] != -1:\n J[A_B[j][0]-1] = 1\n J[A_B[j][1]-1] =-1\n elif H[A_B[j][0]-1] < H[A_B[j][1]-1]:\n if J[A_B[j][0]-1] != -1:\n J[A_B[j][0]-1] = 1\n J[A_B[j][1]-1] = 1\n else:\n J[A_B[j][0]-1] =-1\n J[A_B[j][1]-1] =-1\nfor l in range(N):\n if J[l] == 0:\n J[l] = 1\nprint(J.count(1))', 'N,M = map( int ,input().split())\nH = list(map( int , input().split()))\nA_B = [[0] * 2 for i in range(M)]\nJ = [0]*N\nfor i in range(M):\n A,B = map( int ,input().split())\n A_B[i][0] = A\n A_B[i][1] = B\nfor j in range(M):\n if H[A_B[j][0]-1] > H[A_B[j][1]-1]:\n if J[A_B[j][0]-1] != -1:\n J[A_B[j][0]-1] = 1\n J[A_B[j][1]-1] =-1\n elif H[A_B[j][0]-1] < H[A_B[j][1]-1]:\n J[A_B[j][0]-1] =-1\n if J[A_B[j][1]-1] != -1:\n J[A_B[j][1]-1] = 1\n else:\n J[A_B[j][0]-1] =-1\n J[A_B[j][1]-1] =-1\nfor l in range(N):\n if J[l] == 0:\n J[l] = 1\nprint(J.count(1))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s271888352', 's408252901', 's897193885']
[28928.0, 28824.0, 28940.0]
[354.0, 354.0, 356.0]
[627, 627, 627]
p02689
u867826040
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nh = list(map(int,input().split()))\nl = [tuple(map(int,input().split())) for i in range(m)]\nx = ["B"]*n\nfor t in l:\n if h[t[0]-1] <= h[t[1]-1]:\n x[t[1]-1]="G"\n x[t[0]-1]="B"\n elif h[t[0]-1] >= h[t[1]-1]:\n x[t[1]-1]="B"\n x[t[0]-1]="G"\n print(x)\nprint(x.count("G"))', 'n,m = map(int,input().split())\nh = tuple(map(int,input().split()))\nl = set([tuple(map(int,input().split())) for i in range(m)])\nx = [[] for i in range(n)]\nans=0\nfor t in l:\n x[t[0]-1].append(h[t[1]-1])\n x[t[1]-1].append(h[t[0]-1])\nfor k,li in enumerate(x):\n a = h[k]\n if li == []:\n ans+=1\n else:\n if a>max(li):\n ans+=1\nprint(ans)']
['Runtime Error', 'Accepted']
['s426424850', 's231839589']
[153724.0, 40436.0]
[1997.0, 466.0]
[330, 369]
p02689
u871934301
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int,input().split()))\ngraph = [[] for _ in range(n)]\nfor _ in range(m):\n a, b = map(int, input().split())\n graph[a-1].append(b-1)\n graph[b-1].append(a-1) \nprint(graph)', 'N,M = map(int, input().split())\n\nH=list(map(int,input().split()))\n\ngraph=[[0] for _ in range(N)]\n\nfor i in range(M):\n A, B = map(int, input().split())\n graph[A-1].append(H[B-1])\n graph[B-1].append(H[A-1])\n\nans=0\n\nfor i in range(N):\n if H[i]>max(graph[i]):\n ans+=1\n \nprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n \n \n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n \n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n\n\n \n\n\n \n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n']
['Wrong Answer', 'Accepted']
['s753659294', 's646100309']
[33536.0, 26100.0]
[345.0, 353.0]
[223, 610]
p02689
u878291720
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M = map(int,input().split())\nH = list(map(int,input().split()))\n\nrlist = {n:[] for n in range(1,N+1)}\ncnt = 0\nfor m in range(1.M+1):\n A,B = map(int,input().split())\n rlist[A].append(B)\n rlist[B].append(A)\n\nfor k,v in rlist.items():\n if len(v) == 0:\n cnt += 1\n else:\n for i in v:\n if H[k-1] <= H[i-1]:\n break\n else:\n cnt += 1\n \nprint(cnt)', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\n \nrlist = {n:[] for n in range(1,N+1)}\ncnt = 0\nfor m in range(1,M+1):\n A,B = map(int,input().split())\n rlist[A].append(B)\n rlist[B].append(A)\n \nfor k,v in rlist.items():\n if len(v) == 0:\n cnt += 1\n else:\n for i in v:\n if H[k-1] <= H[i-1]:\n break\n else:\n cnt += 1\n \nprint(cnt)']
['Runtime Error', 'Accepted']
['s943246869', 's622453704']
[9032.0, 37824.0]
[28.0, 454.0]
[375, 378]
p02689
u880400515
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\n\nG = [[] for i in range(N)]\n\nfor i in range(M):\n A, B = list(map(int, input().split()))\n G[A - 1].append(B-1)\n G[B-1].append(A-1)\n\nans = 0\n\nfor i in range(N):\n self_h = H[i]\n\n self_max_flag = True\n\n for to in range(len(G[i])):\n if (self_h <= H[to+1]):\n self_max_flag = False\n \n if (self_max_flag):\n ans += 1\n\n\nprint(ans)', 'N, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\n\nG = [[0]*N for i in range(N)]\n\nfor i in range(M):\n A, B = list(map(int, input().split()))\n G[A][B] = 1\n G[B][A] = 1\n\nans = 0\n\nfor i in range(N):\n self_h = H[i]\n\n self_max_flag = True\n\n for j in range(N):\n if (G[i][j] == 1):\n if (self_h <= H[j]):\n self_max_flag = False\n \n if (self_max_flag):\n ans += 1\n\nprint(ans)', 'N, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\n\nG = []*N\n\nfor i in range(M):\n A, B = list(map(int, input().split()))\n G[A - 1].append(B-1)\n G[B-1].append(A-1)\n\nans = 0\n\nfor i in range(N):\n self_h = H[i]\n\n self_max_flag = True\n\n for to in range(G[i]):\n if (self_h <= H[to]):\n self_max_flag = False\n \n if (self_max_flag):\n ans += 1\n\nprint(ans)', 'N, M = list(map(int, input().split()))\nH = list(map(int, input().split()))\n\nG = [[] for i in range(N)]\n\nfor i in range(M):\n A, B = list(map(int, input().split()))\n G[A - 1].append(B - 1)\n G[B - 1].append(A - 1)\n\nans = 0\n\nfor i in range(N):\n self_h = H[i]\n\n self_max_flag = True\n\n for to in G[i]:\n if (self_h <= H[to]):\n self_max_flag = False\n \n if (self_max_flag):\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s541766722', 's581678869', 's846907328', 's295350968']
[29360.0, 1899496.0, 20120.0, 29452.0]
[350.0, 2261.0, 47.0, 389.0]
[448, 457, 422, 439]
p02689
u883040023
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nH = list(map(int,input().split()))\nedge = [[] for _ in range(n)]\n\nfor _ in range(m):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n edge[a].append(b)\n edge[b].append(a) \n\nans = 0\n\nfor i in range(n):\n x = edge[i]\n \n if len(x) == 0:\n ans += 1\n continue\n \n highest = 0\n \n for j in x:\n highest = max(highest,H[j])\n \n if H[i] > highest:\n ans += 1\n \n print("h",i,x,ans)\n \nprint(ans)', 'n,m = map(int,input().split())\nH = list(map(int,input().split()))\nedge = [[] for _ in range(n)]\n\nfor _ in range(m):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n edge[a].append(b)\n edge[b].append(a) \n\nans = 0\n\nfor i in range(n):\n x = edge[i]\n \n if len(x) == 0:\n ans += 1\n continue\n \n highest = 0\n \n for j in x:\n highest = max(highest,H[j])\n \n if H[i] > highest:\n ans += 1\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s096882661', 's768569505']
[30484.0, 29364.0]
[523.0, 423.0]
[504, 472]
p02689
u886286585
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M = map(int,input().split())\nH = list(map(int,input().split()))\n\ntmp = [1] * N\nmax = 0\n\nAB = [map(int, input().split()) for _ in range(M)]\nA, B = [list(i) for i in zip(*AB)] \n \nfor i in range(M):\n if H[A[i]-1] > H[B[i]-1]:\n tmp[B[i]-1] = 0\n elif H[A[i]-1] < H[B[i]-1]:\n tmp[A[i]-1] = 0\n else:\n tmp[A[i]-1] = 0\n tmp[B[i]-1] = 0\n\nprint(tmp) \n#tmp[H.index(max(H))] = 1\nprint(sum(tmp))', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\n\ntmp = [1] * N\n\nAB = [map(int, input().split()) for _ in range(M)]\nA, B = [list(i) for i in zip(*AB)] \n \nfor i in range(M):\n if H[A[i]-1] > H[B[i]-1]:\n tmp[B[i]-1] = 0\n elif H[A[i]-1] < H[B[i]-1]:\n tmp[A[i]-1] = 0\n else:\n tmp[A[i]-1] = 0\n tmp[B[i]-1] = 0\n\nprint(sum(tmp))']
['Wrong Answer', 'Accepted']
['s727254758', 's375457419']
[67704.0, 67796.0]
[464.0, 472.0]
[409, 360]
p02689
u891945807
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m = map(int,input().split())\nh = list(map(int,input().split()))\n#h.sort()\n\nfor i in range(m):\n a,b = map(int,input().split())\n l[a-1].append(b-1)\n l[b-1].append(a-1)\n\nprint(l)\n \nc = 0\nfor j in range(n):\n if len(l[j]) == 0:\n c += 1\n else:\n m = 0\n for k in l[j]:\n if h[j] <= h[k]:\n m = 1\n break\n if m == 0:\n\n c += 1\n \nprint(c)\n ', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\n#h.sort()\nl = [[] for _ in range(n)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n l[a-1].append(b-1)\n l[b-1].append(a-1)\n\nprint(l)\n av\nc = 0\nfor j in range(n):\n if len(l[j]) == 0:\n c += 1\n else:\n m = 0\n for k in l[j]:\n if h[j] <= h[k]:\n m = 1\n break\n if m == 0:\n\n c += 1\n \nprint(c)\n ', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\n#h.sort()\nl = [[] for _ in range(n)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n l[a-1].append(b-1)\n l[b-1].append(a-1)\n\nc = 0\nfor j in range(n):\n if len(l[j]) == 0:\n c += 1\n else:\n m = 0\n for k in l[j]:\n if h[j] <= h[k]:\n m = 1\n break\n if m == 0:\n\n c += 1\n \nprint(c)\n ']
['Runtime Error', 'Runtime Error', 'Accepted']
['s450477560', 's543110571', 's107851069']
[20140.0, 9048.0, 29468.0]
[41.0, 23.0, 378.0]
[376, 405, 391]
p02689
u892615201
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['\n\ni = list(map(int, input().split())) \nj = list(map(int, input().split())) \n\nlis=[]\nfor i in range (i[0]):\n tendata=[i+1,j[i],0]\n lis.append(tendata)\n\nfor i in range(i[1]):\n miti = list(map(int, input().split()))\n if ((lis[miti[0]-1][1]) > (lis[miti[1]][1])):\n lis[miti[0]-1][2] = (lis[miti[0]-1][2]+100)\n lis[miti[1]-1][2] = (lis[miti[1]-1][2]+2)\n\n elif ((lis[miti[0]-1][1]) < (lis[miti[1]][1])):\n lis[miti[1]-1][2] = (lis[miti[1]-1][2]+100)\n lis[miti[0]-1][2] = (lis[miti[0]-1][2]+2)\n\n\nprint(lis)', '\n\ni = list(map(int, input().split())) \nj = list(map(int, input().split())) \n\nlis=[]\nans = 0\nfor a in range (i[0]):\n tendata=[a+1,j[a],0]\n lis.append(tendata)\n\nfor b in range(i[1]):\n miti = list(map(int, input().split()))\n if ((lis[miti[0]-1][1]) > (lis[miti[1]-1][1])):\n lis[miti[1]-1][2] = 1\n \n elif ((lis[miti[0]-1][1]) == (lis[miti[1]-1][1])):\n lis[miti[1]-1][2] = 1\n lis[miti[0]-1][2] = 1\n\n else:\n lis[miti[0]-1][2] = 1\n\nprint(lis)\nfor c in lis:\n if not (c[2] == 1 ):\n print(c)\n ans = ans+1\n\n \n\nprint(ans)', '\ni = list(map(int, input().split())) \nj = list(map(int, input().split())) \n\nlis=[]\nans = 0\nfor a in range (i[0]):\n tendata=[a+1,j[a],0,]\n lis.append(tendata)\n\nfor b in range(i[1]):\n miti = list(map(int, input().split()))\n if ((lis[miti[0]-1][1]) > (lis[miti[1]-1][1])):\n lis[miti[1]-1][2] = 1\n else:\n lis[miti[0]-1][2] = 1\n\nprint(lis)\nfor c in lis:\n if not (c[2] == 1 ):\n ans = ans+1\n \n\nprint(ans)', '\n\ni = list(map(int, input().split())) \nj = list(map(int, input().split())) \n\nlis=[]\nans = 0\nfor a in range (i[0]):\n tendata=[a+1,j[a],0]\n lis.append(tendata)\n\nfor b in range(i[1]):\n miti = list(map(int, input().split()))\n if ((lis[miti[0]-1][1]) > (lis[miti[1]-1][1])):\n lis[miti[1]-1][2] = 1\n \n elif ((lis[miti[0]-1][1]) == (lis[miti[1]-1][1])):\n lis[miti[1]-1][2] = 1\n lis[miti[0]-1][2] = 1\n\n else:\n lis[miti[0]-1][2] = 1\n\nfor c in lis:\n if not (c[2] == 1 ):\n print(c)\n ans = ans+1\n\n \n\nprint(ans)', '\n\ni = list(map(int, input().split())) \nj = list(map(int, input().split())) \n\nlis=[]\nans = 0\nfor a in range (i[0]):\n tendata=[a+1,j[a],0]\n lis.append(tendata)\n\nfor b in range(i[1]):\n miti = list(map(int, input().split()))\n if ((lis[miti[0]-1][1]) > (lis[miti[1]-1][1])):\n lis[miti[1]-1][2] = 1\n \n elif ((lis[miti[0]-1][1]) == (lis[miti[1]-1][1])):\n lis[miti[1]-1][2] = 1\n lis[miti[0]-1][2] = 1\n\n else:\n lis[miti[0]-1][2] = 1\n\nfor c in lis:\n if not (c[2] == 1 ):\n ans = ans+1\n\nprint(ans)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s275092135', 's290416914', 's516939088', 's670529368', 's021664096']
[26472.0, 31916.0, 31924.0, 26420.0, 26532.0]
[96.0, 446.0, 398.0, 393.0, 359.0]
[541, 583, 444, 572, 545]
p02689
u894074703
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["def q3():\n N, M = (int(i) for i in input().split())\n H = [int(i) for i in input().split()]\n ans = [True]*N\n\n for i in range(M):\n A, B = (int(i) for i in input().split())\n\n if H[A-1] <= H[B-1]:\n ans[A-1] = False\n if H[B-1] <= H[A-1]:\n ans[B-1] = False\n\n print(ans)\n\n\nif __name__ == '__main__':\n q3()\n", "def q3():\n N, M = (int(i) for i in input().split())\n H = [int(i) for i in input().split()]\n ans = [True]*N\n\n for i in range(M):\n A, B = (int(i) for i in input().split())\n\n if H[A-1] <= H[B-1]:\n ans[A-1] = False\n if H[B-1] <= H[A-1]:\n ans[B-1] = False\n\n print(ans.count(True))\n\n\nif __name__ == '__main__':\n q3()\n"]
['Wrong Answer', 'Accepted']
['s984697193', 's181714534']
[20052.0, 20080.0]
[259.0, 255.0]
[360, 372]
p02689
u898421050
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nh = list(map(int, input().split()))\na, b =[], []\nfor i in range(m):\n ab = list(map(int, input().split()))\n a.append(ab[0])\n b.append(ab[1])\n\nbad_list = []\nfor i in range(m):\n if h[a[i]-1] < h[b[i]-1]:\n bad_list.append(a[i])\n else:\n bad_list.append(b[i])\n\nprint(bad_list)\nprint(n - len(set(bad_list)))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nbad_list = []\n\nfor i in range(m):\n a, b = map(int, input().split())\n\n if h[a-1] < h[b-1]:\n bad_list.append(a)\n elif h[a-1] > h[b-1]:\n bad_list.append(b)\n else:\n bad_list.append(a)\n bad_list.append(b)\n\nx = set(bad_list)\nprint(n - len(x))']
['Wrong Answer', 'Accepted']
['s430701234', 's432368167']
[25800.0, 19928.0]
[279.0, 252.0]
[362, 345]
p02689
u901598613
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m=map(int,input().split())\nH=list(map(int,input().split()))\nans=[i for i in range(1,n+1)]\nlow=[]\nfor i in range(m):\n x,y=map(int,input().split())\n if H[x-1]==H[y-1]:\n low.append(x)\n low.append(y)\n elif H[x-1]>H[y-1]:\n low.append(y)\n else:\n low.append(x)\nlow=list(set(low))\nfor k in low:\n ans=ans.remove(k)\nprint(len(ans))', 'n,m=map(int,input().split())\nH=list(map(int,input().split()))\nans=[i for i in range(1,n+1)]\nlow=[]\nload=[map(int,input().split()) for j in range(m)]\nfor i in range(m):\n if H[load[i][0]-1]==H[load[i][1]-1]:\n low.append(load[i][0])\n low.append(load[i][1])\n elif H[load[i][0]-1]>H[load[i][1]-1]:\n low.append(load[i][1])\n else:\n low.append(load[i][0])\nlow=list(set(low))\nfor k in low:\n ans.remove(k)\nprint(len(ans))', 'n,m=map(int,input().split())\nH=list(map(int,input().split()))\nans=[i for i in range(1,n+1)]\nlow=[]\nfor i in range(m):\n x,y=map(int,input().split())\n if H[x-1]==H[y-1]:\n low.append(x)\n low.append(y)\n elif H[x-1]>H[y-1]:\n low.append(y)\n else:\n low.append(x)\nlow=list(set(low))\nprint(len(ans)-len(low))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s145595801', 's841315970', 's159390695']
[23576.0, 60756.0, 23696.0]
[273.0, 356.0, 269.0]
[368, 453, 341]
p02689
u903699277
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['def main():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n S = [list(map(int, input(_).split())) for _ in range(M)]\n LIST = [1] * N\n for A, B in S:\n if H[A-1] >= H[B-1]: LIST[B-1] = 0\n elif H[A-1] <= H[B-1]: LIST[A-1] = 0\n elif H[A-1] == H[B-1]:\n LIST[B - 1] = 0\n LIST[A - 1] = 0\n print(sum(LIST))\n\n\nmain()', 'def main():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n S = [list(map(int, input(_).split())) for _ in range(M)]\n LIST = [1] * N\n for A, B in S:\n if H[A-1] > H[B-1]: LIST[B-1] = 0\n elif H[A-1] < H[B-1]: LIST[A-1] = 0\n elif H[A-1] == H[B-1]:\n LIST[B - 1] = 0\n LIST[A - 1] = 0\n print(sum(LIST))\n\n\nmain()', 'def main():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n S = [list(map(int, input(_).split())) for _ in range(M)]\n #LIST = [1] * N\n LIST = [ 1 for _ in range(N)]\n for A, B in S:\n if H[A-1] >= H[B-1]: LIST[B-1] = 0\n if H[A-1] <= H[B-1]: LIST[A-1] = 0\n# if H[A-1] == H[B-1]:\n# LIST[B - 1] = 0\n# LIST[A - 1] = 0\n print(sum(LIST))\n\nmain()', 'def main():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n S = [list(map(int, input(_).split())) for _ in range(M)]\n LIST = [1] * N\n for A, B in S:\n if H[A-1] >= H[B-1]: LIST[B-1] = 0\n if H[A-1] <= H[B-1]: LIST[A-1] = 0\n if H[A-1] == H[B-1]:\n LIST[B - 1] = 0\n LIST[A - 1] = 0\n print(sum(LIST))\n\nmain()', 'def main():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n# S = [list(map(int, input(_).split())) for _ in range(M)]\n LIST = [1] * N\n #LIST = [ 1 for _ in range(N)]\n for _ in range(M):\n A, B = map(int, input().split())\n if H[A-1] >= H[B-1]: LIST[B-1] = 0\n if H[A-1] <= H[B-1]: LIST[A-1] = 0\n print(sum(LIST))\n \nmain()']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s133823953', 's329927208', 's505045533', 's778338049', 's624686177']
[32008.0, 31960.0, 32004.0, 32028.0, 20012.0]
[460.0, 467.0, 470.0, 492.0, 234.0]
[392, 390, 425, 387, 387]
p02689
u904804404
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import sys\ninput = sys.stdin.readline\n\nN,M = list(map(int,input().split()))\nH = list(map(int,input().split()))\n\n\nfrom collections import defaultdict\nd = defaultdict(int)\nfor i in range(M):\n A,B = list(map(int,input().split()))\n A -= 1\n B -= 1\n if d[A] < H[B]:\n d[A] = H[B]:\n if d[B] < H[A]:\n d[B] = H[A]\ncnt = 0\nfor idx,h in enumerate(H):\n if d[idx] == 0 or h < d[idx]:\n cnt += 1\nelse:\n print(cnt)', 'import sys\ninput = sys.stdin.readline\n\nN,M = list(map(int,input().split()))\nH = list(map(int,input().split()))\n\n\nfrom collections import defaultdict\nd = defaultdict(int)\nfor i in range(M):\n A,B = list(map(int,input().split()))\n A -= 1\n B -= 1\n if d[A] < H[B]:\n d[A] = H[B]\n if d[B] < H[A]:\n d[B] = H[A]\ncnt = 0\nfor idx,h in enumerate(H):\n if d[idx] == 0 or h > d[idx]:\n cnt += 1\nelse:\n print(cnt)\n']
['Runtime Error', 'Accepted']
['s179188740', 's342366538']
[9000.0, 25028.0]
[22.0, 286.0]
[478, 478]
p02689
u905793676
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n,m=map(int,input().split())\nh = list(map(int, input().split()))\nbad = []\nans =[]\n\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1] > h[b-1]:\n bad.append(b)\n elif h[a-1] == h[b-1]:\n bad.append(a)\n bad.append(b)\n else:\n bad.append(a)\n\nj = 1\nfor j in range(n+1):\n if j in bad:\n pass\n else:\n ans.append(j)\n j += 1\n \nprint(ans)\nprint(len(ans)-1)', 'n,m=map(int,input().split())\nh = list(map(int, input().split()))\nbad = []\n\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1] > h[b-1]:\n bad.append(b)\n elif h[a-1] == h[b-1]:\n bad.append(a)\n bad.append(b)\n else:\n bad.append(a)\n\nbad_two = set(bad)\nans = n - len(bad_two)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s993616733', 's390504224']
[20136.0, 20104.0]
[2206.0, 260.0]
[422, 329]
p02689
u910536093
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = list(map(int, input().split()))\n\nheight = [int(i) for i in input().split()]\n\ntele = {}\nfor num, h in enumerate(height, 1):\n tele[num] = [h, "G"]\n\nfor roads in range(m):\n a, b = list(map(int, input().split()))\n if (tele[a][0] >= tele[b][0]):\n tele[b][1] = "N"\n elif (tele[a][0] <= tele[b][0]):\n tele[a][1] = "N"\n\nans_list = tele.values()\nprint(ans_list)\nans = 0\nfor a in ans_list:\n if (a[1] == "G"):\n ans += 1\n\nprint(ans)\n\n', 'n, m = list(map(int, input().split()))\n\nheight = [int(i) for i in input().split()]\n\ntele = {}\nfor num, h in enumerate(height, 1):\n tele[num] = [h, "G"]\n\nfor roads in range(m):\n a, b = list(map(int, input().split()))\n if (tele[a][0] > tele[b][0]):\n tele[b][1] = "N"\n elif (tele[a][0] < tele[b][0]):\n tele[a][1] = "N"\n elif (tele[a][0] == tele[b][0]):\n tele[a][1] = "N"\n tele[b][1] = "N"\n\nans_list = tele.values()\nans = 0\nfor a in ans_list:\n if (a[1] == "G"):\n ans += 1\n\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s935143128', 's347073896']
[33784.0, 31216.0]
[402.0, 406.0]
[465, 534]
p02689
u913392095
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M = map(int,input().split())\nH=list(map(int,input().split()))\nABmap=[[] for i in range(N)]\ncount=0\nfor i in range(M):\n A,B=map(lambda x:x-1,map(int,input().split()))\n ABmap[A].append(H[B])\n ABmap[B].append(H[A])\n \nfor i in range(N):\n if len(ABmap[i])==0:\n count+=1\n elif max(ABmap[i])<H[i]:\n count+=1\n # print(ABmap[i])\n #print(count)\n \n ', 'N,M = map(int,input().split())\nH=list(map(int,input().split()))\nABmap=[[0 for i in range(N)] for i in range(N)]\ncount=0\nfor i in range(M):\n A,B=map(lambda x:x-1,map(int,input().split()))\n ABmap[A][B]=H[B]\n ABmap[B][A]=H[A]\n ABmap[A][A]=H[A]\n ABmap[B][B]=H[B]\n #print(ABmap[A])\n \nfor i in range(M):\n if max(ABmap[i])==H[i]:\n count+=1\nprint(count)\n \n ', 'N,M = map(int,input().split())\nH=list(map(int,input().split()))\nABmap=[[] for i in range(N)]\ncount=0\nfor i in range(M):\n A,B=map(lambda x:x-1,map(int,input().split()))\n ABmap[A].append(H[B])\n ABmap[B].append(H[A])\n \nfor i in range(N):\n if len(ABmap[i])==0:\n count+=1\n elif max(ABmap[i])<H[i]:\n count+=1\n # print(ABmap[i])\nprint(count)\n \n ']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s321737064', 's786165360', 's111125113']
[22940.0, 595312.0, 22936.0]
[408.0, 2220.0, 399.0]
[391, 390, 386]
p02689
u916662650
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N,M = (int(x) for x in input().split())\nhight = [int(x) for x in input().split()]\ntenbou = [input().split() for l in range(M)]\nresult = [1] * N\n\n\nfor i in range(M):\n x = int(tenbou[i][0]) - 1\n y = int(tenbou[i][1]) - 1\n if hight[x] >= hight[y]:\n result[y] = 0\n elif hight[y] > hight[x]:\n result[x] = 0\nprint(result)\nprint(result.count(1))', 'N,M = (int(x) for x in input().split())\nlist = [int(x) for x in input().split()]\ntenbou = [input().split() for l in range(M)]\njj = [1] * N\n\n#print(list)\n\n\nfor i in range(M-1):\n x = int(tenbou[i][0]) - 1\n y = int(tenbou[i][1]) - 1\n if list[x] >= list[y]:\n jj[y] = 0\n elif list[y] > list[x]:\n jj[x] = 0\n\n\nprint(jj) \n\nprint(jj.count(1))', 'N,M = (int(x) for x in input().split())\nhight = [int(x) for x in input().split()]\ntenbou = [input().split() for l in range(M)]\nresult = [1] * N\n\n\nfor i in range(M):\n x = int(tenbou[i][0]) - 1\n y = int(tenbou[i][1]) - 1\n if hight[x] > hight[y]:\n result[y] = 0\n elif hight[y] == hight[x]:\n result[x] = 0\n result[y] = 0\n elif hight[y] > hight[x]:\n result[x] = 0\n#print(result)\nprint(result.count(1))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s423071245', 's531246024', 's822392664']
[43756.0, 43632.0, 43200.0]
[316.0, 345.0, 331.0]
[364, 389, 439]
p02689
u921016616
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['n, m = map(int, input().split())\nl = [1] * (n + 1)\nl[0] = 0 \nh = list(map(int, input().strip().split())) \nb_a = b_b = 0\nfor i in range(m):\n a, b = map(int, input().split())\n if b_a == a and b_b == b :\n l[a] = l[b] = 0\n else if h[a-1] < h[b-1]:\n l[a] = 0\n else if h[a-1] > h[b-1] :\n l[b] = 0\n b_a = a\n b_b = b\n\nprint(sum(l))', 'n, m = map(int, input().split())\nl = [1] * (n + 1)\nl[0] = 0 \nh = list(map(int, input().strip().split()))\nh.insert(0, 0)\n \nfor i in range(m):\n a, b = map(int, input().split())\n if h[a] == h[b] :\n l[a] = l[b] = 0\n elif h[a] < h[b]:\n l[a] = 0\n else :\n l[b] = 0\n \n \nprint(sum(l))']
['Runtime Error', 'Accepted']
['s867762792', 's369252210']
[9052.0, 20784.0]
[20.0, 248.0]
[339, 289]
p02689
u921156673
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int, input().split())\nH = list(map(int, input().split())) \nassert len(H) == N\npaths = [[] for i in range(N)]\nfor m in range(M)\n a, b = map(int, input().split())\n paths[a].append(b)\n paths[b].append(a) \nassert len(A) == M\n\ndef search(a, marks): \n peaks = []\n marks.append(a)\n for b in paths[a]:\n if b not in marks:\n peaks.append(search)\n marks.remove(a)\n if len(peaks):\n return max(H[a], max(peaks))\n return H[a]\n\ncount = 0\nfor a in A:\n if a == search(a, []):\n count += 1\nprint(count)', 'N, M = map(int, input().split())\nH = list(map(int, input().split())) \nassert len(H) == N\npaths = [[] for i in range(N)]\nfor m in range(M):\n a, b = map(int, input().split())\n paths[a].append(b)\n paths[b].append(a) \nassert len(A) == M\n\ncount = 0\nfor a in A:\n for b in paths[b]:\n if H[b] >= H[a]:\n break\n else:\n count += 1\nprint(count)', 'N, M = map(int, input().split())\nH = list(map(int, input().split())) \nassert len(H) == N\npaths = [[] for i in range(N)]\nfor m in range(M):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n paths[a].append(b)\n paths[b].append(a) \n\ncount = 0\nfor a in range(N):\n for b in paths[a]:\n if H[b] >= H[a]:\n break\n else:\n count += 1\nprint(count)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s121120361', 's699842925', 's964826990']
[8928.0, 29324.0, 29432.0]
[28.0, 293.0, 354.0]
[636, 408, 414]
p02689
u921818939
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import collections\nfrom collections import defaultdict\n\nn,m=map(int,input().split())\nh=[int(i) for i in input().split()]\ngraph=defaultdict(list)\nfor i in range(m):\n a,b=map(int,input().split())\n graph[a].append(b)\n graph[b].append(a)\ncount=0\nprint(graph)\nfor i in graph:\n for j in graph[i]:\n if h[j-1]>=h[i-1]:\n break\n else:\n count+=1\nprint(count)\n \n\n\n\n', 'import collections\nfrom collections import defaultdict\ndef bfs(graph, root):\n count=0\n queue=collections.deque([root])\n visited.add(root)\n while queue:\n vertex=queue.popleft()\n ok=True\n for neighbour in graph[vertex]:\n if h[neighbour-1]>=h[vertex-1]:\n ok=False\n if neighbour not in visited:\n visited.add(neighbour)\n queue.append(neighbour)\n \n if ok==True:\n count+=1\n \n return(count)\nn,m=map(int,input().split())\nh=[int(i) for i in input().split()]\ngraph=defaultdict(list)\nseta=set()\nfor i in range(m):\n a,b=map(int,input().split())\n seta.add(a)\n seta.add(b)\n graph[a].append(b)\n graph[b].append(a)\n\nvisited=set()\nans=0\nfor i in range(1,n+1):\n #print(visited,i)\n if i not in visited:\n ans+=bfs(graph,i)\n #print(ans)\nprint(ans)\n \n\n\n\n']
['Wrong Answer', 'Accepted']
['s593811059', 's259726163']
[36572.0, 46804.0]
[499.0, 577.0]
[386, 932]
p02689
u927373043
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['N, M = map(int,input().split())\ngood = [0]*N\n\nH = list(map(int,input().split()))\n\nfor j in range(M):\n a, b = map(int,input().split())\n if(H[a-1] == H[b-1]):\n good[a-1] += 1\n good[b-1] += 1\n elif(H[a-1] < H[b-1]):\n good[a-1] += 1\n elif(H[b-1] < H[a-1]:\n good[b-1] += 1\ncount = 0\nfor i in range(N):\n if(good[i] == 0):\n count += 1\nprint(count)', 'N, M = map(int,input().split())\ngood = [0]*N\n\nH = list(map(int,input().split()))\n\nfor j in range(M):\n a, b = map(int,input().split())\n if(H[a-1] == H[b-1]):\n good[a-1] += 1\n good[b-1] += 1\n elif(H[a-1] < H[b-1]):\n good[a-1] += 1\n else:\n good[b-1] += 1\ncount = 0\nfor i in range(N):\n if(good[i] == 0):\n count += 1\nprint(count)']
['Runtime Error', 'Accepted']
['s360060973', 's242215663']
[8996.0, 20908.0]
[22.0, 283.0]
[360, 344]
p02689
u928758473
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
['import os\n\ndef main():\n\tn,m = map(int, input().split())\n\th_list = list(map(int, input().split()))\n\tans = [1]*n\n\tresult = []\n\tfor i in range(m):\n\t\ta,b = map(int, input().split())\n\t\tif h_list[a-1] < h_list[b-1]:\n\t\t\tans[a-1] = 0\t\n\t\telse:\n\t\t\tans[b-1] = 0\n\t\tresult.append(a)\n\t\tresult.append(b)\n\tprint(ans)\n\tprint(sum(ans))\t\t\t\n\nif __name__ == "__main__":\n\tmain()\n', 'import os\n\ndef main():\n\tn,m = map(int, input().split())\n\th_list = list(map(int, input().split()))\n\tans = [1]*n\n\tfor i in range(m):\n\t\ta,b = map(int, input().split())\n\t\tif h_list[a-1] < h_list[b-1]:\n\t\t\tans[a-1] = 0\t\n\t\telif h_list[a-1] == h_list[b-1]:\n\t\t\tans[a-1] = 0\n\t\t\tans[b-1] = 0\n\t\telse:\n\t\t\tans[b-1] = 0\n\tprint(sum(ans))\t\t\t\n\nif __name__ == "__main__":\n\tmain()\n']
['Wrong Answer', 'Accepted']
['s594658330', 's395715817']
[22464.0, 20128.0]
[250.0, 237.0]
[357, 361]
p02689
u929996201
2,000
1,048,576
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there?
["def main():\n n,m = map(int,input().split())\n s = [int(n) for n in input().split()]\n cs = s\n for i in range(m):\n a,b = map(int,input().split())\n a-=1,b-=1\n if(s[a] < s[b]):\n cs[a]=-1\n else if(s[a] == s[b]):\n cs[a]=-1\n cs[b]=-1\n else:\n cs[b]=-1\n print(cs.count(-1))\n \nif __name__ == '__main__':\n main()", 'N, M =map(int, input().split())\nH_tree =[int(n) for n in input().split()]\nGOOD_Tree = [1 for n in range(N)]\n \nfor i in range(M):\n A, B = map(int, input().split())\n if H_tree[A]<=H_tree[B]:GOOD_Tree[A] = 0\n if H_tree[A]>=H_tree[B]:GOOD_Tree[B] = 0\nprint(sum(GOOD_Tree))', 'N, M =map(int, input().split())\nH_tree = [0] + [int(n) for n in input().split()]\nGOOD_tree = [0] + [1 for n in range(N)]\n \nfor i in range(M):\n A, B = map(int, input().split())\n if H_tree[A]<=H_tree[B]:GOOD_Tree[A] = 0\n if H_tree[A]>=H_tree[B]:GOOD_Tree[B] = 0\nprint(sum(GOOD_tree))', '\n\n#include <map>\n#include <cstdlib>\n#include <algorithm>\nusing namespace std;\n \nint main() {\n int n,m;\n int cnt=0;\n cin >> n >> m;\n \n vector<int> v,x;\n\n int a,b;\n for(int i = 0; i < n; ++i) {\n cin >> a;\n v.push_back(a);\n }\n x = v;\n \n for(int i = 0; i < m; ++i) {\n cin >> a >> b;\n a--;\n b--;\n if(v[a] < v[b]) x[a] = -1;\n else if(v[a] == v[b]) {\n x[a] = -1;\n x[b] = -1;\n }else x[b] = -1;\n }\n\n cout << v.size() - count(x.begin(), x.end(), -1) << "\\n";\n return 0;\n}', '\n\n#include <map>\n#include <cstdlib>\n#include <algorithm>\nusing namespace std;\n \nint main() {\n int n,m;\n int cnt=0;\n cin >> n >> m;\n \n vector<int> v,x;\n \n int a,b;\n for(int i = 0; i < n; ++i) {\n cin >> a;\n v.push_back(a);\n }\n x = v;\n \n for(int i = 0; i < m; ++i) {\n cin >> a >> b;\n a--;\n b--;\n if(v[a] < v[b]) {\n x[a] = -1;\n }\n else if(v[a] == v[b]) {\n x[a] = -1;\n x[b] = -1;\n }else if(x[b] < x[a]) {\n x[b] = -1;\n }\n }\n \n cout << v.size() - count(x.begin(), x.end(), -1) << "\\n";\n return 0;\n}', "def main():\n n,m = map(int,input().split())\n s = [int(n) for n in input().split()]\n cs = s\n for i in range(m):\n a,b = map(int,input().split())\n a-=1,b-=1\n if(s[a] < s[b]):\n cs[a]='1'\n else if(s[a] == s[b]):\n cs[a]='1'\n cs[b]='1'\n else:\n cs[b]='1'\n print(cs.count('1'))\n \nif __name__ == '__main__':\n main()", "def main():\n n,m = map(int,input().split())\n s = list(map(int,input.split()))\n cs = s\n for i in range(m):\n a,b = map(int,input().split())\n a-=1,b-=1\n if(s[a] < s[b]):\n cs[a]=-1\n else if(s[a] == s[b]):\n cs[a]=-1\n cs[b]=-1\n else:\n cs[b]=-1\n print(cs.count(-1))\n \nif __name__ == '__main__':\n main()", "import copy\n\ndef main():\n n,m = map(int,input().split())\n s = [int(n) for n in input().split()]\n cs = copy.copy(s)\n for i in range(m):\n a,b = map(int,input().split())\n a-=1\n b-=1\n if(s[a] < s[b]):\n cs[a] = -1\n elif(s[a] == s[b]):\n cs[a] = -1\n cs[b] = -1\n elif(s[b] < s[a]):\n cs[b] = -1\n print(cs)\n print()\n print(len(cs)-cs.count(-1))\n \nif __name__ == '__main__':\n main()", "import copy\n\ndef main():\n n,m = map(int,input().split())\n s = [int(n) for n in input().split()]\n cs = copy.copy(s)\n for i in range(m):\n a,b = map(int,input().split())\n a-=1\n b-=1\n if(s[a] < s[b]):\n cs[a] = -1\n elif(s[a] == s[b]):\n cs[a] = -1\n cs[b] = -1\n elif(s[b] < s[a]):\n cs[b] = -1\n print(len(cs)-cs.count(-1))\n \nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s201196936', 's267160925', 's322192536', 's536302203', 's904946894', 's910146468', 's951855240', 's996449140', 's257999295']
[8952.0, 20104.0, 19964.0, 9012.0, 8952.0, 8940.0, 9036.0, 21012.0, 21000.0]
[22.0, 251.0, 52.0, 24.0, 22.0, 21.0, 20.0, 238.0, 245.0]
[346, 271, 284, 545, 591, 351, 341, 422, 400]