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
|
u072284094
| 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?
|
['count, way = list(map(int, input().split()))\nheight = list(map(int, input().split()))\nisGood = [True] * count\n\nfor i in range(way):\n obs_a, obs_b = list(map(lambda x: int(x) - 1, input().split()))\n if(height[obs_a] > height[obs_b]):\n isGood[obs_b] = False\n else:\n isGood[obs_a] = False\n\nprint(isGood)', 'count, way = list(map(int, input().split()))\nheight = list(map(int, input().split()))\nisGood = [True] * count\n\nfor i in range(way):\n obs_a, obs_b = list(map(lambda x: int(x) - 1, input().split()))\n if(height[obs_a] > height[obs_b]):\n isGood[obs_b] = False\n elif(height[obs_b] > height[obs_a]):\n isGood[obs_a] = False\n else:\n isGood[obs_a] = False\n isGood[obs_b] = False\n\n\nprint(len([ i for i in isGood if i ]))']
|
['Wrong Answer', 'Accepted']
|
['s903261882', 's435619222']
|
[20056.0, 20128.0]
|
[271.0, 270.0]
|
[323, 450]
|
p02689
|
u078276601
| 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_list = list(map(int, input().split()))\nnewlist = list(h_list)\nfor i in range(m):\n a, b = map(int, input().split())\n if h_list[a-1] < h_list[b-1]:\n newlist[a-1] = 0\n elif h_list[a-1] > h_list[b-1]:\n newlistlist[b-1] = 0\n else:\n newlist[a-1] = 0\n newlist[b-1] = 0\nprint(len(h_list) - newlist.count(0))', 'h_list = list(map(int, input().split())) \nnewlist = list(h_list) \nfor i in range(m):\n a, b = map(int, input().split())\n if h_list[a-1] < h_list[b-1]:\n newlist[a-1] = 0\n elif h_list[a-1] > h_list[b-1]:\n newlist[b-1] = 0\n else:\n newlist[a-1] = 0\n newlist[b-1] = 0\nprint(len(h_list) - newlist.count(0))', 'h_list = list(map(int, input().split())) \nnewlist = list(h_list) \nfor i in range(m):\n a, b = map(int, input().split())\n if h_list[a-1] < h_list[b-1]:\n newlist[a-1] = 0\n elif h_list[a-1] > h_list[b-1]:\n newlistlist[b-1] = 0\n else:\n newlist[a-1] = 0\n newlist[b-1] = 0\nprint(len(h_list) - newlist.count(0))', 'n,m = map(int, input().split())\nh_list = list(map(int, input().split())) \nnewlist = list(h_list) \nfor i in range(m):\n a, b = map(int, input().split())\n if h_list[a-1] < h_list[b-1]:\n newlist[a-1] = 0\n elif h_list[a-1] > h_list[b-1]:\n newlist[b-1] = 0\n else:\n newlist[a-1] = 0\n newlist[b-1] = 0\nprint(n - newlist.count(0))']
|
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
|
['s731967093', 's896167393', 's971693996', 's542437791']
|
[9156.0, 9140.0, 9168.0, 20112.0]
|
[24.0, 25.0, 29.0, 250.0]
|
[341, 389, 393, 411]
|
p02689
|
u082978753
| 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())\nlisH = list(map(int, input().split()))\n\nlisN = [[] for i in range(N)]\nfor i in range(M):\n inlis = list(map(int, input().split()))\n lisN[max(inlis)-1].append(lisH[min(inlis)-1])\n\nans = 0\nfor i in range(N):\n if len(lisN[i])>0:\n if lisH[i] > max(lisN[i]):\n ans += 1\n else :\n ans += 1\nprint(ans)', 'N, M = map(int, input().split())\nlisH = list(map(int, input().split()))\n\nlisN = [[] for i in range(N)]\nlisIdx = []\nfor i in range(M):\n inlis = list(map(int, input().split()))\n lisN[max(inlis)-1].append(lisH[min(inlis)-1])\n lisN[min(inlis)-1].append(lisH[max(inlis)-1])\n lisIdx += inlis\n\nans = 0\nfor i in range(N):\n if len(lisN[i])>0:\n if lisH[i] > max(lisN[i]):\n ans += 1\nans += N - len(set(lisIdx))\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s814915663', 's495922236']
|
[22028.0, 37604.0]
|
[362.0, 516.0]
|
[361, 443]
|
p02689
|
u086138398
| 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?
|
['temp = input().split(" ")\nN = int(temp[0])\nM = int(temp[1])\nH = input().split(" ")\ngood = [1] * N\nfor i in range(M):\n root = input().split(" ")\n a = int(root[0])-1\n b = int(root[1])-1\n if H[a]=>H[b]:\n good[b] = 0\n if H[a]<H[b]:\n good[a] = 0\n\nprint(sum(good))', 'temp = input().split(" ")\nN = int(temp[0])\nM = int(temp[1])\nH = input().split(" ")\ngood = [1] * N\nfor i in range(M):\n root = input().split(" ")\n a = int(root[0])-1\n b = int(root[1])-1\n if int(H[a])>=int(H[b]):\n good[b] = 0\n if int(H[a])<=int(H[b]):\n good[a] = 0\nprint(sum(good))\n']
|
['Runtime Error', 'Accepted']
|
['s229052105', 's080721808']
|
[9048.0, 18340.0]
|
[23.0, 682.0]
|
[287, 308]
|
p02689
|
u086624329
| 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()))\n\ntower=[0]*N\n\n\n\nfor i in range(M):\n A,B=map(int,input().split())\n if height[A-1]<height[B-1]:\n tower[A-1]=1\n else:\n tower[B-1]=1\n \n print(tower)\n \nprint(tower.count(0))\n ', 'N,M=map(int,input().split())\n\nheight=list(map(int,input().split()))\n\ntower=[0]*N\n\nfor i in range(M):\n A,B=map(int,input().split())\n if height[A-1]<height[B-1]:\n tower[A-1]=1\n elif height[A-1]>height[B-1]:\n tower[B-1]=1\n else:\n tower[A-1]=1\n tower[B-1]=1\n \nprint(tower.count(0))']
|
['Wrong Answer', 'Accepted']
|
['s760433750', 's249282546']
|
[137316.0, 20116.0]
|
[3045.0, 251.0]
|
[281, 320]
|
p02689
|
u091307273
| 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 = (int(i) for i in input().split())\n h = [int(i) for i in input().split()]\n roads = [(int(i) for i in input().split()) for _ in range(m)]\n\n nbors = [[] for _ in range(n)]\n for a, b in roads:\n nbors[a-1].append(b-1)\n nbors[b-1].append(a-1)\n\n ngood = 0\n for o in range(n):\n if all(h[o] > h[nb] for nb in nbors[o]):\n ngood += 1\n\n return ngood\n\nmain()\n', 'def main():\n n, m = (int(i) for i in input().split())\n h = [int(i) for i in input().split()]\n roads = [(int(i) - 1 for i in input().split()) for _ in range(m)]\n\n nbors = [[] for _ in range(n)]\n for a, b in roads:\n nbors[a].append(b)\n nbors[b].append(a)\n\n ngood = 0\n for o in range(n):\n if all(h[o] > h[nb] for nb in nbors[o]):\n ngood += 1\n\n print(ngood)\n\nmain()\n']
|
['Wrong Answer', 'Accepted']
|
['s677878252', 's959286670']
|
[110344.0, 110416.0]
|
[653.0, 656.0]
|
[422, 418]
|
p02689
|
u091489347
| 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?
|
['l = list(map(int, input().split()))\nli = list(map(int, input().split()))\n\ng = []\nfor i in range(l[1]):\n a, b = map(int, input().split())\n if li[a-1] == li[b-1]:\n g += [a, b]\n if li[a-1] >= li[b-1]:\n g += [b]\n else:\n g += [a]\n print(g)\n\ng = set(g)\nprint(l[0] - len(g))', 'l = list(map(int, input().split()))\nli = list(map(int, input().split()))\n\ng = []\nfor i in range(l[1]):\n a, b = map(int, input().split())\n if li[a-1] == li[b-1]:\n g += [a, b]\n if li[a-1] > li[b-1]:\n g += [b]\n else:\n g += [a]\n\ng = set(g)\nr = l[0] - len(g)\nprint(r)']
|
['Runtime Error', 'Accepted']
|
['s755653879', 's856426110']
|
[141228.0, 20112.0]
|
[1590.0, 260.0]
|
[304, 296]
|
p02689
|
u095384238
| 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())\nH = list(map(int, input().split()))\nyoi = np.ones(M)\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] > H[B-1]:\n yoi[B-1] = 0\n elif H[B-1] > H[A-1]:\n yoi[A-1] = 0\n elif H[A-1]==H[B-1]:\n yoi[A-1] = 0\n yoi[B-1] = 0\nprint(int(np.sum(yoi)))', 'import numpy as np\nN, M = map(int, input().split())\nH = list(map(int, input().split()))\nyoi = np.ones(N)\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] > H[B-1]:\n yoi[B-1] = 0\n elif H[B-1] > H[A-1]:\n yoi[A-1] = 0\n elif H[A-1]==H[B-1]:\n yoi[A-1] = 0\n yoi[B-1] = 0\nprint(int(np.sum(yoi)))']
|
['Runtime Error', 'Accepted']
|
['s860655518', 's671161071']
|
[38620.0, 38592.0]
|
[364.0, 349.0]
|
[343, 343]
|
p02689
|
u101785141
| 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_array = list(map(int, input().split()))\nab = []\nsum = 0\n\nfor i in range(m):\n ab.append(list(map(int, input().split())))\n\nprint(ab)\n\nfor i in range(1, n + 1):\n array = [element for element in ab if element[0] == i or element[1] == i]\n array.sort()\n result = True\n print(array)\n for j in range(len(array)):\n if (i == array[j][1]):\n if h_array[array[j][0]- 1] >= h_array[i - 1]:\n result = False\n else:\n if h_array[array[j][1]- 1] >= h_array[i - 1]:\n result = False\n if result:\n sum += 1\n\nprint(sum)', 'n, m = map(int, input().split())\nh_array = list(map(int, input().split()))\nab = []\nsum = 0\n\nfor i in range(m):\n ab.append(list(map(int, input().split())))\n\nfor i in range(1, n + 1):\n array = [element for element in ab if element[0] == i or element[1] == i]\n array.sort()\n result = True\n print(array)\n for j in range(len(array)):\n if (i == array[j][1]):\n if h_array[array[j][0]- 1] >= h_array[i - 1]:\n result = False\n else:\n if h_array[array[j][1]- 1] >= h_array[i - 1]:\n result = False\n if result:\n sum += 1\n\nprint(sum)', 'n, m = map(int, input().split())\nh_array = list(map(int, input().split()))\nab = []\nsum = 0\nanswer = [True for i in range(n)]\n\nfor i in range(m):\n ab.append(list(map(int, input().split())))\n\nfor i in range(len(ab)):\n if h_array[ab[i][0]- 1] >= h_array[ab[i][1]- 1]:\n answer[ab[i][1] - 1] = False\n if h_array[ab[i][1]- 1] >= h_array[ab[i][0]- 1]:\n answer[ab[i][0] - 1] = False\n\nprint(answer.count(True))']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s156949789', 's223624559', 's450638233']
|
[35064.0, 31472.0, 31992.0]
|
[2206.0, 2206.0, 339.0]
|
[570, 559, 412]
|
p02689
|
u102367647
| 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?
|
["from sys import stdin\nimport numpy as np\n\n\ndef main():\n n, m = list(map(int, stdin.readline().split()))\n hList = list(map(int, stdin.readline().split()))\n ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]\n hRelations = np.zeros((n, n))\n '''\n for a, b in ABList:\n if hList[a-1] >= hList[b-1]:\n hRelations[b-1, a-1] = 1\n if hList[b-1] >= hList[a-1]:\n hRelations[a-1, b-1] = 1\n total = 0\n print(total)\n for hRelation in hRelations:\n if hRelation.sum() == 0:\n total += 1\n print(total)\n '''\n\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin\nimport numpy as np\n\n\ndef main():\n n, m = list(map(int, stdin.readline().split()))\n hList = list(map(int, stdin.readline().split()))\n ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]\n '''\n hRelations = np.zeros((n, n))\n for a, b in ABList:\n if hList[a-1] >= hList[b-1]:\n hRelations[b-1, a-1] = 1\n if hList[b-1] >= hList[a-1]:\n hRelations[a-1, b-1] = 1\n total = 0\n print(total)\n for hRelation in hRelations:\n if hRelation.sum() == 0:\n total += 1\n print(total)\n '''\n\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin\nimport numpy as np\n\n\ndef main():\n n, m = list(map(int, stdin.readline().split()))\n hList = list(map(int, stdin.readline().split()))\n ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]\n hRelations = np.zeros((n, n))\n for a, b in ABList:\n if hList[a-1] >= hList[b-1]:\n hRelations[b-1, a-1] = 1\n if hList[b-1] >= hList[a-1]:\n hRelations[a-1, b-1] = 1\n total = 0\n print(total)\n for hRelation in hRelations:\n if hRelation.sum() == 0:\n total += 1\n print(total)\n\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin\nimport numpy as np\n\n\ndef main():\n n, m = list(map(int, stdin.readline().split()))\n hList = list(map(int, stdin.readline().split()))\n ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]\n hRelations = np.zeros((n, n))\n print(1)\n for a, b in ABList:\n if hList[a-1] >= hList[b-1]:\n hRelations[b-1, a-1] = 1\n if hList[b-1] >= hList[a-1]:\n hRelations[a-1, b-1] = 1\n total = 0\n for hRelation in hRelations:\n if hRelation.sum() == 0:\n total += 1\n print(total)\n\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin\nimport numpy as np\n\n\ndef main():\n n, m = list(map(int, stdin.readline().split()))\n hList = list(map(int, stdin.readline().split()))\n ABList = [list(map(int, stdin.readline().split())) for _ in range(m)]\n maxHeights = np.zeros(n)\n for a, b in ABList:\n if hList[a-1] >= maxHeights[b-1]:\n maxHeights[b-1] = hList[a-1]\n if hList[b-1] >= maxHeights[a-1]:\n maxHeights[a-1] = hList[b-1]\n total = 0\n i = 0\n for maxHeight in maxHeights:\n if maxHeight < hList[i]:\n total += 1\n i += 1\n print(total)\n\n\nif __name__ == '__main__':\n main()\n"]
|
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
|
['s397484398', 's428940629', 's441355848', 's682005285', 's187039498']
|
[49808.0, 49724.0, 49684.0, 49808.0, 49692.0]
|
[239.0, 226.0, 225.0, 230.0, 387.0]
|
[633, 633, 617, 613, 638]
|
p02689
|
u103341055
| 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(h) for h in input().split()]\n\nd = {}\n\nfor i in range(N):\n d[i+1] = H[i]\n\nfor _ in range(M):\n A,B = map(int,input().split())\n\n if H[B-1] > H[A]:\n d[A] = 0\n\n elif H[B-1] < H[A]:\n d[B] = 0\n\n elif H[B-1] == H[A]:\n d[A] = 0\n d[B] = 0\n\n\nprint(N - list(d.values()).count(0))', 'N,M = map(int,input().split())\nH = [int(h) for h in input().split()]\n\nd = {}\n\nfor i in range(N):\n d[i+1] = H[i]\n\nfor _ in range(M):\n A,B = map(int,input().split())\n\n if H[B-1] >= H[A-1]:\n d[A] = 0\n\n if H[B-1] <= H[A-1]:\n d[B] = 0\n\nprint(N - list(d.values()).count(0))']
|
['Runtime Error', 'Accepted']
|
['s478185917', 's186563729']
|
[24472.0, 24492.0]
|
[283.0, 334.0]
|
[350, 293]
|
p02689
|
u105290050
| 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 = [[] for _ in range(n)]\n#print(l)\n#print(h)\nfor i in range(m):\n a, b=map(int, input().split())\n l[a-1].append(b)\n l[b-1].append(a)\nans=0\nprint(l)\nfor x in range(n):\n for y in range(len(l[x])):\n if h[x]<=h[l[x][y]-1]:\n break\n else:\n print(x)\n ans+=1\n continue\n \n \n \n\n \n \n ', 'n, m=map(int, input().split())\nh=list(map(int,input().split()))\nl = [[] for _ in range(n)]\n#print(l)\n#print(h)\nfor i in range(m):\n a, b=map(int, input().split())\n l[a-1].append(b)\n l[b-1].append(a)\nans=0\nfor x in range(n):\n for y in range(len(l[x])):\n if h[x]<=h[l[x][y]-1]:\n break\n else:\n ans+=1\n continue\nprint(ans)\n \n \n \n\n \n \n ']
|
['Wrong Answer', 'Accepted']
|
['s535740345', 's209157405']
|
[33268.0, 29352.0]
|
[414.0, 364.0]
|
[390, 379]
|
p02689
|
u111652094
| 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\nans_list=list(range(1,N+1))\n\nfor i in range(M):\n a,b=map(int,input().split())\n if H[a-1]<H[b-1]:\n if a in ans_list:\n ans_list.remove(a)\n if H[a-1]>H[b-1]:\n if b in ans_list:\n ans_list.remove(b)\n if H[a-1]==H[b-1]:\n if a in ans_list:\n ans_list.remove(a) \n if b in ans_list:\n ans_list.remove(b)\nprint(len(ans_list))\nprint(ans_list)', '\n\nN,M=map(int,input().split())\nH=list(map(int,input().split()))\n\nans_list=[1]*N\n\nfor i in range(M):\n a,b=map(int,input().split())\n if H[a-1]<H[b-1]:\n ans_list[a-1]=0\n if H[a-1]>H[b-1]:\n ans_list[b-1]=0\n if H[a-1]==H[b-1]:\n ans_list[a-1]=0\n ans_list[b-1]=0\nprint(sum(ans_list))']
|
['Wrong Answer', 'Accepted']
|
['s390602877', 's589727332']
|
[20060.0, 20036.0]
|
[2206.0, 294.0]
|
[482, 316]
|
p02689
|
u115110170
| 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 = [1]*n\n\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a]>=h[b]:\n ans[b-1]=0\n if h[a]<=h[b]:\n ans[a-1]=0\nprint(sum(ans))\n \n\n \n ', 'n,m = map(int,input().split())\nh= list(map(int,input().split()))\nans = [1]*n\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 ans[b]=0\n if h[a]<=h[b]:\n ans[a]=0\nprint(sum(ans))']
|
['Runtime Error', 'Accepted']
|
['s500161758', 's282427997']
|
[20104.0, 20104.0]
|
[243.0, 260.0]
|
[219, 219]
|
p02689
|
u116038906
| 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?
|
['\nimport sys\ninput = sys.stdin.readline\nN,M = (int(x) for x in input().split())\nH = [-1]+list(map(int, input().split()))\n\n\nobserv_H ={}\nconnction ={i:set() for i in range(1,N+1)}\n\n\nfor i in range(1,M+1):\n a,b = (int(x) for x in input().split())\n connction[a].add(b)\n connction[b].add(a)\n \n\nfor i in range(1,N+1):\n observ_H[i] = H[i]\n#observ_H.sort(key=lambda x:x[1],reverse=True)\nobserv_good ={i:"bad"}\nhantei="bad"\nfor num,connect in connction.items():\n hantei ="bad"\n for saki in connect:\n if observ_H[num] > observ_H[saki]:\n hantei ="good"\n if hantei=="good":\n observ_good[num] ="good"\nprint(len(i))\n', '\nimport sys\ninput = sys.stdin.readline\nN,M = (int(x) for x in input().split())\nH = [-1]+list(map(int, input().split()))\n\n\nobserv_H ={}\nconnection ={i:set() for i in range(1,N+1)}\n\n\nfor i in range(1,M+1):\n a,b = (int(x) for x in input().split())\n connection[a].add(b)\n connection[b].add(a)\n \n\nfor i in range(1,N+1):\n observ_H[i] = H[i]\n#observ_H.sort(key=lambda x:x[1],reverse=True)\nobserv_good ={}\nhantei=1\nfor num,connect in connection.items():\n hantei =1\n for saki in connect:\n if observ_H[num] > observ_H[saki]:\n hantei *=1\n else:\n hantei=0\n if hantei==1:\n observ_good[num] ="good"\nprint(len(observ_good))']
|
['Runtime Error', 'Accepted']
|
['s555567316', 's635982160']
|
[65944.0, 66092.0]
|
[448.0, 467.0]
|
[742, 766]
|
p02689
|
u119012830
| 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\nh = list(int, input())\na = [0]*m\nb = [0]*m\nfor i in range(m):\n a[i], b[i] = map(int, input().split())\nlist = []\nfor i in range(m):\n if h[a[i]-1] > h[b[i]-1]:\n list.append(a[i])\n elif h[a[i]-1] == h[b[i]-1]:\n list.append(a[i])\n list.append(b[i])\n else:\n list.append(b[i])\n\nlistans = [0]*n\nfor i in range(len(list)):\n listans[list[i] - 1] += 1\nans = 0\nfor i in range(n):\n if listans[i] == 0:\n ans += 1\nprint(ans)', 'n, m = [int(i) for i in input().split()]\n\nh = [int(i) for i in input().split()]\n\nlist = [[]for i in range(n)]\nfor i in range(m):\n a, b = [int(i) for i in input().split()]\n list[a-1].append(h[b-1])\n list[b-1].append(h[a-1])\nans = 0\nfor i in range(n):\n if len(list[i]) == 0:\n ans += 1\n elif h[i] > max(list[i]):\n ans += 1\nprint(ans)']
|
['Runtime Error', 'Accepted']
|
['s161956925', 's892963059']
|
[10976.0, 23104.0]
|
[22.0, 393.0]
|
[543, 408]
|
p02689
|
u119982001
| 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=int(input())\n\nfor i in range(0, 1000):\n for j in range(-1000,0):\n if X == (i**5-j**5):\n print(i, j)\n exit()\n', 'X=int(input())\n\nfor i in range(0, 1000):\n for j in range(-1000,0):\n if X == (i**5-j**5):\n print(i, j)\n exit()\n', 'N,M=map(int, input().split())\nH=list(map(int, input().split()))\n\nans = [True]*N\nctr = 0\n\nfor _ in range(M):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n if H[a] >= H[b]: ans[b] = False\n if H[a] <= H[b]: ans[a] = False\n\nfor i in range(N):\n if ans[i]:\n ctr += 1\n\nprint(ctr)\n']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s016395328', 's403044492', 's643553643']
|
[9068.0, 9172.0, 20144.0]
|
[26.0, 23.0, 262.0]
|
[142, 142, 303]
|
p02689
|
u126146165
| 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())\nhigh = list(map(int, input().split()))\n\njudge = ["ok" for i in range(n)]\n\nfor i in range(m):\n a, b = [int(s) - 1 for i in input().split()]\n\n if high[a] < high[b]:\n judge[a] = "ng"\n elif high[a] > high[b]:\n judge[b] = "ng"\n else:\n judge[a] = "ng"\n judge[b] = "ng"\n\nprint(judge.count("ok"))\n', 'n, m = map(int, input().split())\nhigh = list(map(int, input().split()))\n\njudge = ["ok" for i in range(n)]\n\nfor i in range(m):\n a, b = [int(s) - 1 for s in input().split()]\n\n if high[a] < high[b]:\n judge[a] = "ng"\n elif high[a] > high[b]:\n judge[b] = "ng"\n else:\n judge[a] = "ng"\n judge[b] = "ng"\n\nprint(judge.count("ok"))\n']
|
['Runtime Error', 'Accepted']
|
['s040423675', 's302304171']
|
[20080.0, 20100.0]
|
[49.0, 249.0]
|
[362, 362]
|
p02689
|
u129749062
| 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())\nAB = list()\ngood = [0]*N\ncount = 0\nH = list(map(int,input().split()))\nfor _ in range(M):\n ab = list(map(int,input().split()))\n AB.append(ab)\nprint(AB)\nfor i in range(M):\n if H[AB[i][0]-1] > H[AB[i][1]-1]:\n good[AB[i][1]-1] = -1\n elif H[AB[i][0]-1] < H[AB[i][1]-1]:\n good[AB[i][0]-1] = -1\n elif H[AB[i][0]-1] == H[AB[i][1]-1]:\n good[AB[i][0]-1] = -1\n good[AB[i][1]-1] = -1\nfor i in range(N):\n if good[i]==0:\n count = count + 1\nprint(good)\nprint(count)', 'N, M = map(int,input().split())\nAB = list()\ngood = [-1]*N\ncount = 0\nH = list(map(int,input().split()))\nfor _ in range(M):\n ab = list(map(int,input().split()))\n AB.append(ab)\nprint(AB)\nfor i in range(M):\n if H[AB[i][0]-1] > H[AB[i][1]-1]:\n good[AB[i][1]-1] = -2\n good[AB[i][0]-1] = 0\n else:\n good[AB[i][0]-1] = -2\n good[AB[i][1]-1] = 0\nfor i in range(N):\n if good[i]==0:\n count = count + 1\nprint(good)\nprint(count)', 'N, M = map(int,input().split())\nAB = list()\ngood = [0]*N\ncount = 0\nH = list(map(int,input().split()))\nfor _ in range(M):\n ab = list(map(int,input().split()))\n AB.append(ab)\nfor i in range(M):\n if H[AB[i][0]-1] > H[AB[i][1]-1]:\n good[AB[i][1]-1] = -1\n elif H[AB[i][0]-1] < H[AB[i][1]-1]:\n good[AB[i][0]-1] = -1\n elif H[AB[i][0]-1] == H[AB[i][1]-1]:\n good[AB[i][0]-1] = -1\n good[AB[i][1]-1] = -1\nfor i in range(N):\n if good[i]==0:\n count = count + 1\nprint(count)']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s098515382', 's181668750', 's221937077']
|
[35892.0, 35868.0, 31928.0]
|
[389.0, 363.0, 345.0]
|
[503, 433, 481]
|
p02689
|
u131411061
| 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\nd = []\nfor i in range(M):\n A,B = map(int,input().split())\n d.append((A-1,B-1))\n\ncnt = 0\n#res = {}\n\n# res[i] = False\nflag = {}\nfor i in range(N):\n flag[i] = True\n\nfor i in d:\n A = i[0]\n B = i[1]\n #print("H[A] > H[B]",H[A],H[B])\n if H[A] > H[B] and flag[A] == True:\n #res[A] = True\n else:\n flag[A] = False\n #res[A] = False\n #print("H[A] < H[B]",H[A],H[B])\n if H[B] > H[A] and flag[B] == True:\n #res[B] = True\n else:\n flag[B] = False\n #res[B] = False\nprint(list(flag.values()).count(True))', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\n\nd = []\nfor i in range(M):\n A,B = map(int,input().split())\n d.append((A-1,B-1))\n\ncnt = 0\nflag = {}\nfor i in range(N):\n flag[i] = True\n\nfor i in d:\n A = i[0]\n B = i[1]\n if not(H[A] > H[B] and flag[A] == True):\n flag[A] = False\n if not(H[B] > H[A] and flag[B] == True):\n flag[B] = False\nprint(list(flag.values()).count(True))']
|
['Runtime Error', 'Accepted']
|
['s253795163', 's035298615']
|
[8996.0, 38024.0]
|
[22.0, 369.0]
|
[650, 424]
|
p02689
|
u133174241
| 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\nfor i in range(N):\n L[i] = [1]\nprint(L)\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] > H[B-1]:\n L[B-1].append(0)\n elif H[A-1] < H[B-1]:\n L[A-1].append(0)\n else:\n L[A-1].append(0)\n L[B-1].append(0)\ndame = 0\nfor i in range(N):\n if 0 in L[i]:\n dame = dame + 1\n else:\n continue\nkaito = N - dame\nprint(kaito)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nL = [0]*N\nfor i in range(N):\n L[i] = [1]\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] > H[B-1]:\n L[B-1].append(0)\n elif H[A-1] < H[B-1]:\n L[A-1].append(0)\n else:\n L[A-1].append(0)\n L[B-1].append(0)\ndame = 0\nfor i in range(N):\n if 0 in L[i]:\n dame = dame + 1\n else:\n continue\nkaito = N - dame\nprint(kaito)']
|
['Wrong Answer', 'Accepted']
|
['s904264797', 's370658468']
|
[25416.0, 24496.0]
|
[369.0, 326.0]
|
[464, 455]
|
p02689
|
u135116520
| 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]*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])\ns=0\nfor i in range(M):\n if H[i]>A[i]:\n s+=1\nprint(s)\n ', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\nA=[0]*N\nfor i in range(M):\n a,b=list(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])\ns=0\nfor i in range(N):\n if H[i]>A[i]:\n s+=1\nprint(s)\n \n\n']
|
['Runtime Error', 'Accepted']
|
['s149105080', 's474395193']
|
[9020.0, 20040.0]
|
[20.0, 331.0]
|
[271, 246]
|
p02689
|
u135961419
| 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 = []\nb = []\nfor i in range(m):\n a0, b0 = list(map(int,input().split()))\n a.append(a0)\n b.append(b0)\n \ncount = [0] * n\n\nfor i in range(m):\n if h[a[i] - 1] <= h[b[i] - 1]:\n count[a[i] - 1] = 1\n if h[a[i] - 1] >= h[b[i] - 1]:\n\tcount[b[i] - 1] = 1\n \nprint(count.count(0))', 'n, m = list(map(int,input().split()))\nh = list(map(int,input().split()))\na = []\nb = []\nfor i in range(m):\n a0, b0 = list(map(int,input().split()))\n a.append(a0)\n b.append(b0)\n \ncount = [0] * n\n\nfor i in range(m):\n if h[a[i] - 1] <= h[b[i] - 1]:\n count[a[i] - 1] = 1\n if h[a[i] - 1] >= h[b[i] - 1]:\n count[b[i] - 1] = 1\n \nprint(count.count(0))']
|
['Runtime Error', 'Accepted']
|
['s393806529', 's337365061']
|
[9072.0, 22240.0]
|
[24.0, 300.0]
|
[356, 359]
|
p02689
|
u137226361
| 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?
|
['from itertools import chain\n\nn, m = map(int, input().split())\nH = list(map(int, input().split()))\n\nab = []\nfor i in range(m):\n ab.append(list(map(int, input().split())))\n\ncount = 0\n\nfor i in range(1, n+1):\n\n c= []\n e= []\n for j in ab:\n if i in j:\n c.append(j)\n d =list(chain.from_iterable(c))\n\n for k in d:\n e.append(H[k-1])\n\n if len(e)==0:\n\n continue\n else max(e) == H[i-1]:\n count += 1\n\nprint(count)', "from itertools import chain\n\nn, m = map(int, input().split())\nH = list(map(int, input().split()))\n\nab = []\nfor i in range(m):\n ab.append(list(map(int, input().split())))\n\ncount = 0\n\nfor i in range(1, n+1):\n f = {i}\n c= []\n e= []\n for j in ab:\n if i in j:\n c.append(j)\n d =set(chain.from_iterable(c)) -f\n #print(d)\n\n for k in d:\n e.append(H[k-1])\n\n\n\n if len(e)==0:\n count += 1\n #print('Yes')\n\n continue\n elif max(e) < H[i-1]:\n print(i, H[i - 1], max(e))\n count += 1\n #print('Yes')\n else:\n pass\n\nprint(count)", 'N, M = map(int, input().split())\nc_list = [[] for _ in range(N)]\ne_list = list(map(int, input().split()))\nfor _ in range(M):\n a, b = map(lambda i: int(i) - 1, input().split())\n c_list[a].append(b)\n c_list[b].append(a)\nans = 0\nfor i, e in enumerate(e_list):\n for j in c_list[i]:\n if e <= e_list[j]:\n break\n else:\n ans += 1\n\nprint(ans)']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s239813119', 's472293066', 's149240909']
|
[8912.0, 31392.0, 31092.0]
|
[22.0, 2206.0, 388.0]
|
[464, 613, 365]
|
p02689
|
u138045722
| 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?
|
['a=input().split()\nN=int(a[0])\nM=int(a[1])\nH=[int(x) for x in input().split()]\nway=[]\nfor i in range(M):\n way.append([int(x) for x in input().split()])\nprint(way)\ndic={}\nfor i in range(N):\n dic[i]=set()\n\nfor h in way:\n dic[h[0]-1].add(h[1]-1)\n dic[h[1]-1].add(h[0]-1)\n print(dic)\n\nprint(sum(all([H[i]>H[hs] for hs in dic[i]])for i in range(N)))', 'a=input().split()\nN=int(a[0])\nM=int(a[1])\nH=[int(x) for x in input().split()]\nway=[]\nfor i in range(M):\n way.append([int(x) for x in input().split()])\n\ndic={}\nfor i in range(N):\n dic[i]=set()\n\nfor h in way:\n dic[h[0]-1].add(h[1]-1)\n dic[h[1]-1].add(h[0]-1)\n \n\nprint(sum(all([H[i]>H[hs] for hs in dic[i]])for i in range(N)))']
|
['Wrong Answer', 'Accepted']
|
['s282440722', 's473867253']
|
[157748.0, 70532.0]
|
[2611.0, 540.0]
|
[358, 338]
|
p02689
|
u139940813
| 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\nh = [int(i) for i in 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 if h[a - 1] < h[b - 1]:\n judge[a - 1] = False\n if h[a - 1] == h[b - 1]:\n judge[b-1] = False\n judge[a - 1] = False\n\nprint(jadge.count(True))', 'N,M= map(int,input().split())\n\nh = [int(i) for i in 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 if h[a - 1] < h[b - 1]:\n judge[a - 1] = False\n if h[a - 1] == h[b - 1]:\n judge[b-1] = False\n judge[a - 1] = False\n\nprint(judge.count(True))']
|
['Runtime Error', 'Accepted']
|
['s767595164', 's450826353']
|
[20124.0, 20104.0]
|
[286.0, 286.0]
|
[363, 363]
|
p02689
|
u140191608
| 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 itertools\nN , M = (map(int , input().split()))\nH = list(map(int , input().split()))\nAB = [list(map(int, input().split())) for i in range(M)]\nHH = {i+1 : H[i] for i in range(len(H))}\ncount = []\nfor i in AB:\n if HH[i[1]] > HH[i[0]]:\n count.append(i[1])\nfor i in HH:\n if i in CC:\n pass\n else:\n count.append(i)\nprint(len(list(set(count))))', 'N , M = (map(int , input().split()))\nH = list(map(int , input().split()))\nAB = [list(map(int, input().split())) for i in range(M)]\nHH = {i+1 : H[i] for i in range(len(H))}\n\ncount = {i+1 : 0 for i in range(N)}\nfor i in AB:\n if HH[i[1]] > HH[i[0]]:\n count[i[0]] -= 1\n elif HH[i[1]] == HH[i[0]]:\n count[i[0]] -= 1\n count[i[1]] -= 1\n else:\n count[i[1]] -= 1\n \nprint(sum([1 for i in count.values() if i == 0]))']
|
['Runtime Error', 'Accepted']
|
['s189726644', 's490419673']
|
[42816.0, 52740.0]
|
[328.0, 355.0]
|
[372, 449]
|
p02689
|
u146597538
| 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\nab = [list(map(lambda x: x -1, list(map(int, input().split())))) for _ in range(m)]\nprint(ab)\n\n\nans = 0\nfor i in range(n):\n cnt_flag = True\n for j in ab:\n if i in j:\n if h[i] <= h[list(((set(j))^{i}))[0]]:\n cnt_flag=False\n break\n if cnt_flag:\n ans+=1\nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\n\nab = [list(map(lambda x: x -1, map(int, input().split()))) for _ in range(m)]\n\n\nans_list = [True] * n\nfor i in range(m):\n if h[ab[i][0]] >= h[ab[i][1]]:\n ans_list[ab[i][1]] = False\n if h[ab[i][0]] <= h[ab[i][1]]:\n ans_list[ab[i][0]] = False\nprint(sum(ans_list))']
|
['Wrong Answer', 'Accepted']
|
['s694466309', 's897555170']
|
[35128.0, 31996.0]
|
[2207.0, 353.0]
|
[427, 458]
|
p02689
|
u153846982
| 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()))\n# print(height)\nbridge = [[] for i in range(n)]\n\nfor i in range(m):\n\ta,b = map(int,input().split())\n\tbridge[a-1].append(b-1)\n\tbridge[b-1].append(a-1)\n\n# print(bridge)\ngood = [None for i in range(n)]\n# print(good)\n\nflag = True\nfor i in range(n):\n\tflag = True\n\tif good[i] == None:\n\t\t\n\t\tfor tembo in bridge[i]:\n\t\t\t\n\t\t\tif height[i] <= height[tembo]:\n\t\t\t\t\n\t\t\t\tflag = False\n\t\tgood[i] = flag\n\t\tif good[i]:\n\t\t\tfor tembo in bridge[i]:\n\t\t\t\tgood[tembo] = False\n\nprint(good)\nans = 0\nfor x in good:\n\tif x:\n\t\tans += 1\nprint(ans)', 'n,m = map(int,input().split())\nheight = list(map(int,input().split()))\n# print(height)\nbridge = [[] for i in range(n)]\n\nfor i in range(m):\n\ta,b = map(int,input().split())\n\tbridge[a-1].append(b-1)\n\tbridge[b-1].append(a-1)\n\n# print(bridge)\ngood = [None for i in range(n)]\n# print(good)\n\nflag = True\nfor i in range(n):\n\tflag = True\n\tif good[i] == None:\n\t\t\n\t\tfor tembo in bridge[i]:\n\t\t\t\n\t\t\tif height[i] <= height[tembo]:\n\t\t\t\t\n\t\t\t\tflag = False\n\t\tgood[i] = flag\n\t\tif good[i]:\n\t\t\tfor tembo in bridge[i]:\n\t\t\t\tgood[tembo] = False\n\n# print(good)\nans = 0\nfor x in good:\n\tif x:\n\t\tans += 1\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s092468258', 's432473226']
|
[31548.0, 30364.0]
|
[381.0, 440.0]
|
[776, 778]
|
p02689
|
u161164709
| 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 i in range(M)]\n\ntf_array = [0]*N\n\nfor a, b in AB:\n print(a,b)\n if H[a-1] > H[b-1]:\n tf_array[b-1] += 1\n elif H[a-1] == H[b-1]:\n tf_array[a-1] += 1\n tf_array[b-1] += 1\n else:\n tf_array[a-1] += 1\n\nprint(tf_array.count(0))', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for i in range(M)]\n\ntf_array = [0]*N\n\nfor a, b in AB:\n if H[a-1] > H[b-1]:\n tf_array[b-1] += 1\n elif H[a-1] == H[b-1]:\n tf_array[a-1] += 1\n tf_array[b-1] += 1\n else:\n tf_array[a-1] += 1\n\nprint(tf_array.count(0))\n']
|
['Wrong Answer', 'Accepted']
|
['s406346476', 's978368631']
|
[32272.0, 31980.0]
|
[374.0, 295.0]
|
[370, 356]
|
p02689
|
u161537170
| 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?
|
['number_of_observatory, number_of_road = map(int, input().split())\nheight_list = [0] \nheight_list.extend(list(map(int, input().split())))\n\nroad_list = []\nfor i in range(number_of_road):\n li = list(map(int, input().split()))\n road_list.append(li) \ncounta = 0\n\nnot_good_list = []\n\nfor road in road_list:\n if height_list[road[0]] < height_list[road[1]]:\n not_good_list.append(road[0])\n elif height_list[road[0]] > height_list[road[1]]:\n not_good_list.append(road[1])\n else:\n not_good_list.extend(road)\n\nnot_good_set = set(not_good_list)\nobservatory_set = set(range(1, number_of_observatory))\n\nprint(len(observatory_set - not_good_set))\n', 'number_of_observatory, number_of_road = map(int, input().split())\nheight_list = [0] \nheight_list.extend(list(map(int, input().split())))\n\nroad_list = []\nfor i in range(number_of_road):\n li = list(map(int, input().split()))\n road_list.append(li) \ncounta = 0\n\nnot_good_list = []\n\nfor road in road_list:\n if height_list[road[0]] < height_list[road[1]]:\n not_good_list.append(road[0])\n elif height_list[road[0]] > height_list[road[1]]:\n not_good_list.append(road[1])\n else:\n not_good_list.extend(road)\n\nnot_good_set = set(not_good_list)\nobservatory_set = set(range(1, number_of_observatory+1))\n\nprint(len(observatory_set - not_good_set))\n']
|
['Wrong Answer', 'Accepted']
|
['s797199638', 's034328775']
|
[44716.0, 44408.0]
|
[324.0, 329.0]
|
[791, 793]
|
p02689
|
u162893962
| 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?
|
['# from collections import defaultdict\n\nn, m = map(int, input().split())\nhigh = [int(i) for i in input().split()]\n\n\nhigh_d = {}\nfor i in range(n):\n \n high_d[i+1] = high[i]\nprint(high_d)\n\nd = {}\nfor _ in range(m):\n a, b = map(int, input().split())\n if a not in d:\n d[a] = [b] \n else:\n d[a].append(b)\n if b not in d:\n d[b] = [a] \n else:\n d[b].append(a)\n\n\nprint(d)\ncnt = 0\nfor i, li in d.items():\n # [a].append(b)\n is_true = True\n for j in li:\n if high_d[i] > high_d[j]:\n continue\n else:\n is_true = False\n if is_true:\n cnt += 1\n\ncnt += n - len(d)\n\nprint(cnt)\n', '# from collections import defaultdict\n\nn, m = map(int, input().split())\nhigh = [int(i) for i in input().split()]\n\n\nhigh_d = {}\nfor i in range(n):\n \n high_d[i+1] = high[i]\n# print(high_d)\n\nd = {}\nfor _ in range(m):\n a, b = map(int, input().split())\n if a not in d:\n d[a] = [b] \n else:\n d[a].append(b)\n if b not in d:\n d[b] = [a] \n else:\n d[b].append(a)\n\n\n# print(d)\ncnt = 0\nfor i, li in d.items():\n # [a].append(b)\n is_true = True\n for j in li:\n if high_d[i] > high_d[j]:\n continue\n else:\n is_true = False\n if is_true:\n cnt += 1\n\ncnt += n - len(d)\n\nprint(cnt)\n']
|
['Wrong Answer', 'Accepted']
|
['s276904912', 's042790667']
|
[43532.0, 41540.0]
|
[555.0, 432.0]
|
[791, 795]
|
p02689
|
u163783894
| 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)\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', 'Accepted']
|
['s718563690', 's879552296']
|
[29332.0, 29476.0]
|
[372.0, 342.0]
|
[539, 531]
|
p02689
|
u167647458
| 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 _ in range(m)]\n\nx = [set() for _ in range(n)]\nfor a, b in ab:\n x[a-1].add(b-1)\n x[b-1].add(a-1)\nprint(x) \nans = 0\nfor i, xx in enumerate(x):\n for xxx in xx:\n if h[i] <= h[xxx]:\n break\n else:\n ans += 1\n \nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(m)]\n\nx = [set() for _ in range(n)]\nfor a, b in ab:\n x[a-1].add(b-1)\n x[b-1].add(a-1)\n \nans = 0\nfor i, xx in enumerate(x):\n for xxx in xx:\n if h[i] <= h[xxx]:\n break\n else:\n ans += 1\n \nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s990605843', 's614886350']
|
[68224.0, 63512.0]
|
[564.0, 472.0]
|
[371, 363]
|
p02689
|
u171328579
| 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())\nH = list(map(int, input().split()))\n\nGT = [1 for i in range(N)]\n\nfor i in range(M):\n A, B = (int(x) for x in input().split())\n if H[A-1] != H[B-1]:\n L = min(H[A-1], H[B-1])\n GT[H.index(L)] = 0\n else:\n GT[A-1] = 0\n GT[B-1] = 0\n \nprint(GT)', 'N, M = (int(x) for x in input().split())\nH = list(map(int, input().split()))\n\nHT = [0 for i in range(N)]\n\nfor i in range(M):\n A, B = (int(x) for x in input().split())\n HT[A-1] = max(HT[A-1], H[B-1])\n HT[B-1] = max(HT[B-1], H[A-1])\n \ncount = 0\n\nfor i in range(N):\n count += H[i] > HT[i]\n\nprint(count)']
|
['Wrong Answer', 'Accepted']
|
['s520605185', 's840469107']
|
[20124.0, 20128.0]
|
[2206.0, 352.0]
|
[318, 314]
|
p02689
|
u174181999
| 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 = [list(map(int, input().split())) for i in range(M)]\nl = list()\nm = list()\ncnt = 0\nfor i in range(N):\n for j in range(M):\n if i+1 in C[j]:\n l = l + [H[C[j][0]-1], H[C[j][1]-1]]\n else:\n pass\n print(l)\n if len(l) == 0:\n cnt += 1\n elif H[i] == max(l):\n \n \n elif H[i] > max(l):\n cnt += 1\n else:\n pass\n l = list()\n m = list()\nprint(cnt)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nC = [list(map(int, input().split())) for i in range(M)]\nl = list()\ncnt = 0\nfor i in range(N):\n for j in range(M):\n if i+1 in C[j] and H[C[j][0]-1] != H[C[j][1]-1]:\n l = l + [H[C[j][0]-1], H[C[j][1]-1]]\n elif i+1 in C[j] and H[C[j][0]-1] == H[C[j][1]-1]:\n cnt -= 1 \n else:\n pass\n print(l)\n if len(l) == 0:\n cnt += 1\n elif H[i] >= max(l):\n cnt += 1\n else:\n pass\n l = list()\nprint(cnt)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nx = [1] * N\n\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] <= H[B-1]:\n x[A-1] = 0\n if H[A-1] >= H[B-1]:\n x[B-1] = 0\nprint(x.count(1))']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s828372414', 's952014821', 's933825804']
|
[8988.0, 31264.0, 19980.0]
|
[23.0, 2206.0, 250.0]
|
[440, 491, 229]
|
p02689
|
u175746978
| 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 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\nfor k in ll:\n if k==1:\n ans+=1\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\nfor k in ll:\n if k==0:\n ans+=1\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s320806538', 's609929954']
|
[29112.0, 29240.0]
|
[309.0, 306.0]
|
[390, 390]
|
p02689
|
u178465329
| 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 = list(map(int, input().split(" ")))\nh = list(map(int, input().split(" ")))\n\nans = [1] * n\n\nfor i in range(m):\n a, b = list(map(int, input().split(" ")))\n a,b = a-1,b-1\n\n if h[a] < h[b]:\n ans[a] = 0\n elif h[b] < h[a]:\n ans[b] = 0\n else:\n ans[a] = 0\n ans[b] = 0\n\nprint(ans)\n\n\n', '\nn, m = list(map(int, input().split(" ")))\nh = list(map(int, input().split(" ")))\n\nans = [1] * n\n\nfor i in range(m):\n a, b = list(map(int, input().split(" ")))\n a,b = a-1,b-1\n\n if h[a] < h[b]:\n ans[a] = 0\n elif h[b] < h[a]:\n ans[b] = 0\n else:\n ans[a] = 0\n ans[b] = 0\n\nprint(ans.count(1))\n\n\n']
|
['Wrong Answer', 'Accepted']
|
['s211684497', 's324780998']
|
[20116.0, 20116.0]
|
[269.0, 267.0]
|
[324, 333]
|
p02689
|
u179304833
| 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?
|
['from collections import Counter\nn=int(input())\nalist=list(map(int,input().split()))\na1=[]\na2=[]\nfor i,a in enumerate(alist):\n a2.append(i-a)\n a1.append(i+a)\naa=Counter(a2)\ncount=0\nfor k in a1:\n count+=aa.get(k,0)\nprint(count)', 'import numpy as np\nn,m=map(int,input().split())\nhlist = list(map(int,input().split()))\nablist = []\nfor i in range(m):\n ablist.append(input().split())\nx=np.zeros(n,int)\nfor ab in ablist:\n a=int(ab[0])\n b=int(ab[1])\n if hlist[a-1]<hlist[b-1]:\n x[a-1]=1\n elif hlist[a-1]>hlist[b-1]:\n x[b-1]=1\n elif hlist[a-1]==hlist[b-1]:\n x[a-1]=1\n x[b-1]=1\ncount=0\nfor l in range(n):\n if x[l]==0:\n count+=1\nprint(count)']
|
['Runtime Error', 'Accepted']
|
['s939102550', 's722714374']
|
[9368.0, 61380.0]
|
[23.0, 420.0]
|
[228, 440]
|
p02689
|
u181159654
| 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()))\nnum = [0]*n\nchk = [0]*n\nfor _ in range(m):\n a, b = map(int, input().split())\n num[a-1] += 1\n num[b-1] += 1\n if h[a-1]>h[b-1]:\n chk[a-1] += 1\n elif h[b-1]>h[a-1]:\n chk[b-1] += 1\nans = 0\nfor i in range(m):\n if num[i]==chk[i]:\n ans += 1\nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\n\nma = [0]*n\nfor _ in range(m):\n a, b = map(int, input().split())\n ma[a-1] = max(h[b-1], ma[a-1])\n ma[b-1] = max(h[a-1], ma[b-1])\n\nans = 0\nfor i in range(n):\n if h[i]>ma[i]:\n ans += 1\nprint(ans)']
|
['Runtime Error', 'Accepted']
|
['s573162747', 's566096641']
|
[20136.0, 20116.0]
|
[301.0, 333.0]
|
[352, 281]
|
p02689
|
u185297444
| 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?
|
['#ABC166d\nN, M = map(int,input().split())\nH = list(map(int, input().split()))\ncount=[0]*M\nA = [0]*M\nB = [0]*M\n\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n\nans = [1]*N\n\nfor i in range(N):\n if H[A[i]-1] == H[B[i]-1]:\n ans[A[i]-1] = 0\n ans[B[i]-1] = 0\n elif H[A[i]-1] > H[B[i]-1]:\n ans[B[i]-1] = 0\n elif H[A[i]-1] < H[B[i]-1]:\n ans[A[i]-1] = 0\nprint(sum(ans))\n', '#ABC166d\nN, M = map(int,input().split())\nH = list(map(int, input().split()))\ncount=[0]*M\nA = [0]*M\nB = [0]*M\n\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n\nans = [1]*N\n\nfor i in range(N):\n if H[A[i]-1] == H[B[i]-1]:\n ans[A[i]-1] = 0\n ans[B[i]-1] = 0\n elif H[A[i]-1] > H[B[i]-1]:\n ans[B[i]-1] = 0\n elif H[A[i]-1] < H[B[i]-1]:\n ans[A[i]-1] = 0\nprint(sum(ans))\n', '#ABC166d\nN, M = map(int,input().split())\nH = list(map(int, input().split()))\ncount=[0]*M\nA = [0]*M\nB = [0]*M\n\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n\nans = [1]*N\n\nfor i in range(M):\n if H[A[i]-1] == H[B[i]-1]:\n ans[A[i]-1] = 0\n ans[B[i]-1] = 0\n elif H[A[i]-1] > H[B[i]-1]:\n ans[B[i]-1] = 0\n elif H[A[i]-1] < H[B[i]-1]:\n ans[A[i]-1] = 0\nprint(sum(ans))\n']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s226909098', 's653134660', 's033422699']
|
[22456.0, 22476.0, 22576.0]
|
[293.0, 297.0, 292.0]
|
[412, 412, 412]
|
p02689
|
u185393907
| 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 = input().split()\narea = [[] for i in range(N)]\nfor i in range(M):\n road = input().split()\n for place in road:\n area[int(road[0])-1].append(int(height[int(road[1])-1]))\n area[int(road[1])-1].append(int(height[int(road[0])-1]))\ncounter = 0\nfor i in range(N):\n if not area[i]:\n counter=counter+1\n elif int(height[i]) > max(area[i]):\n counter=counter+1\nprint(area)\nprint(counter)', 'N, M = map(int, input().split())\nheight = input().split()\narea = [[] for i in range(N)]\nfor i in range(M):\n road = input().split()\n for place in road:\n area[int(road[0])-1].append(int(height[int(road[1])-1]))\n area[int(road[1])-1].append(int(height[int(road[0])-1]))\ncounter = 0\nfor i in range(N):\n if not area[i]:\n counter=counter+1\n elif int(height[i]) > max(area[i]):\n counter=counter+1\nprint(counter)']
|
['Wrong Answer', 'Accepted']
|
['s760211857', 's379426747']
|
[50752.0, 40176.0]
|
[731.0, 607.0]
|
[456, 444]
|
p02689
|
u185405877
| 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()))\ni = list(map(int, input().split()))\nk=i\nans=0\nfor j in range(m):\n a,b = list(map(int, input().split()))\n if i[a-1]==i[b-1]:\n k[a-1]=0\n k[b-1]=0\n else:\n if i[b-1]>i[a-1]:\n k[a-1]=0\n else:\n k[b-1]=0\n \nfor w in range(n):\n if k[w]!=0:\n ans+=1\nprint(ans)\nprint(k)', 'n,m = list(map(int, input().split()))\ni = list(map(int, input().split()))\nk=[0]*n\nans=0\nfor j in range(m):\n \n a,b = list(map(int, input().split()))\n a-=1\n b-=1\n if i[a]==i[b]:\n k[a]+=1\n k[b]+=1\n \n else:\n if i[b]>i[a]:\n k[a]+=1\n else:\n k[b]+=1\n \nfor w in range(n):\n if k[w]==0:\n ans+=1\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s552555146', 's818930038']
|
[19996.0, 20136.0]
|
[298.0, 278.0]
|
[376, 390]
|
p02689
|
u194472175
| 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 = [[]*i for i in range(N)]\nprint(l)\nfor i in range(M):\n A,B=map(int,input().split())\n l[A-1].append(B)\n l[B-1].append(A)\nans=0\nfor j in range(N):\n if all(H[elem-1] < H[j] for elem in l[j])==True:\n ans +=1\nprint(ans)', 'N,M = map(int,input().split())\nH=list(map(int,input().split()))\nl = [[]*i for i in range(N)]\nfor i in range(M):\n A,B=map(int,input().split())\n l[A-1].append(B)\n l[B-1].append(A)\nans=0\nfor j in range(N):\n if all(H[elem-1] < H[j] for elem in l[j])==True:\n ans +=1\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s236790719', 's226419121']
|
[30176.0, 29468.0]
|
[415.0, 409.0]
|
[300, 291]
|
p02689
|
u199941968
| 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())\nhigh_list=list(map(int,input().split()))\npathlist=[]\nfor i in range(M):\n pathlist.append(list(map(int,input().split())))\nwaylist=[0]*N\nans=0\n\nfor n in range(1,N+1):\n for m in pathlist:\n if(n in m):\n if(m[0]==n):\n if(high_list[n-1]>high_list[m[1]-1]):\n ans=ans+1\n else:\n if(high_list[n-1]>high_list[m[0]-1]):\n ans=ans+1\nprint(ans)\n\n\n', 'import numpy as np\nN,M=map(int,input().split())\nhigh_list=list(map(int,input().split()))\npathlist=[]\nfor i in range(M):\n pathlist.append(list(map(int,input().split())))\nwaylist=np.array([[0]*N]*N)\n\nfor n in range(1,N+1):\n for m in pathlist:\n if(n in m):\n print(n,"in",m)\n if(m[0]==n):\n print("[",n-1,",",m[1]-1,"]","=",high_list[m[1]-1])\n waylist[n-1][m[1]-1]=high_list[m[1]-1]\n else:\n print("[",n-1,",",m[0]-1,"]","=",high_list[m[0]-1])\n waylist[n-1][m[0]-1]=high_list[m[0]-1]\n\nanswer=0\nfor n in range(N):\n if(waylist[n].max()<high_list[n]):\n answer=answer+1\n\n\nprint(answer)\n#print(maxlist.count(max(maxlist)))\n\n\n', 'N,M=map(int,input().split())\nhigh_list=list(map(int,input().split()))\nhighest=[True]*N\nfor i in range(M):\n a,b=map(int,input().split()))\n if(high_list[a-1]>=high_list[b-1]):\n highest[b-1]=False\n if(high_list[a-1]<=high_list[b-1]):\n highest[a-1]=False\nprint(sum(highest))\n\n\n', 'N,M=map(int,input().split())\nhigh_list=list(map(int,input().split()))\nhighest=[True]*N\nfor i in range(M):\n a,b=map(int,input().split())\n if(high_list[a-1]>=high_list[b-1]):\n highest[b-1]=False\n if(high_list[a-1]<=high_list[b-1]):\n highest[a-1]=False\nprint(sum(highest))\n\n\n']
|
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
|
['s352800483', 's412255078', 's701383162', 's320049994']
|
[32028.0, 50992.0, 8940.0, 20052.0]
|
[2206.0, 2207.0, 23.0, 252.0]
|
[601, 905, 296, 295]
|
p02689
|
u202406075
| 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\n\nn,m = map(int, input().split())\nh = np.array(list(map(int, input().split())))\n\nhigh = np.array([0]*n)\ncnt = np.array([0]*n)\n\nfor _ in range(m):\n a,b = map(int, input().split())\n if h[a-1] > h[b-1]:\n h[a-1] += 1\n \n elif h[a-1] < h[b-1]:\n h[b-1] += 1\n cnt[a-1] += 1\n cnt[b-1] += 1\n\nans = np.count_nonzero(high>=1) +np.count_nonzero(cnt==0)\n\nprint(ans)', 'import numpy as np\n\nn,m = map(int, input().split())\nh = np.array(list(map(int, input().split())))\n\nhigh = np.array([0]*n)\ncnt = np.array([0]*n)\n\nfor _ in range(m):\n a,b = map(int, input().split())\n if h[a-1] > h[b-1]:\n h[a-1] += 1\n \n elif h[a-1] < h[b-1]:\n h[b-1] += 1\n cnt[a-1] += 1\n cnt[b-1] += 1\n\nans = np.count_nonzero(high==1) +np.count_nonzero(cnt==0)\n\nprint(ans)', 'import numpy as np\n\nn,m = map(int, input().split())\nh = np.array(list(map(int, input().split())))\n\nhigh = np.array([True]*n)\ncnt = np.array([False]*n)\n\nfor _ in range(m):\n a,b = map(int, input().split())\n if h[a-1] < h[b-1]:\n high[a-1] = False\n \n elif h[a-1] > h[b-1]:\n high[b-1] = False\n \n else:\n high[a-1] = False\n high[b-1] = False\n\nans = np.count_nonzero(high==True)\n\nprint(ans)']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s622626938', 's768806682', 's345884369']
|
[38500.0, 38620.0, 38576.0]
|
[518.0, 506.0, 396.0]
|
[401, 401, 428]
|
p02689
|
u208309047
| 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()))\npreH = [0 for i in range(N)]\n\nfor i in range(M):\n preH.append(list(map(int, input().split())))\nans = [True]*n\n\nfor i in range(M):\n A,B = preH[i] \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\nprint(ans.count(True))', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\npreH = [0 for i in range(N)]\n\nfor i in range(M):\n preH.append(list(map(int, input().split())))\nans = [True]*N\n\nfor i in range(M):\n A,B = preH[i] \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\nprint(ans.count(True))', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\npreH =[]\nfor i in range(M):\n preH.append(list(map(int, input().split())))\nans = [True]*N\n\nfor i in range(M):\n A,B = preH[i]\n\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\nprint(ans.count(True))']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s558353039', 's884867075', 's501361355']
|
[32892.0, 32884.0, 32032.0]
|
[250.0, 253.0, 337.0]
|
[362, 362, 322]
|
p02689
|
u213299590
| 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=(map(int,input().split()) for _ in range(M))\nA,B=(list(i) for i in zip(*AB))\nimport numpy as np\nC=np.ones(N)\nd=0\ndef m(a,b):\n if H[b-1]>H[a-1]:\n return [a,a]\n if H[a-1]>H[b-1]:\n return [b,b]\n if H[b-1]==H[a-1]:\n return [a,b]\nfor i in range(M):\n C[m(A[i],B[i])[0]-1]=0\n C[m(A[i],B[i])[1]-1]=0\nfor j in range(N):\n d=d+C[j]\nprint(C)\nprint(int(d))', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\nAB=(map(int,input().split()) for _ in range(M))\nA,B=(list(i) for i in zip(*AB))\nimport numpy as np\nC=np.ones(N)\nd=0\ndef m(a,b):\n if H[b-1]>H[a-1]:\n return [a,a]\n if H[a-1]>H[b-1]:\n return [b,b]\n if H[b-1]==H[a-1]:\n return [a,b]\nfor i in range(M):\n C[m(A[i],B[i])[0]-1]=0\n C[m(A[i],B[i])[1]-1]=0\nfor j in range(N):\n d=d+C[j]\nprint(int(d))']
|
['Wrong Answer', 'Accepted']
|
['s513161421', 's813679457']
|
[66076.0, 66120.0]
|
[633.0, 695.0]
|
[423, 414]
|
p02689
|
u213401801
| 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 ma(li):\n \n max_num = 0\n for i in li:\n if max_num < i:\n max_num = i\n return max_num\n\ndef appen(li,yousa):\n li.append(yousa)\n return li\n \ndef main():\n res=0\n n,m=map(int,input().split())\n h=list(map(int,input().split()))\n \n a=[list(map(int,input().split())) for i in range(m)]\n f=[]\n for i in range(n):\n f.append([0])\n for i in a:\n f[i[0]-1].append(h[i[1]-1])\n f[i[1]-1].append(h[i[0]-1])\n p=-1\n for i in f:\n p+=1\n if len(i)==1:\n res+=1\n elif ma(i)<h[p]:\n res+=1\n else:\n continue\n\n print(res)', "def ma(li):\n \n max_num = 0\n for i in li:\n if max_num < i:\n max_num = i\n return max_num\n\ndef appen(li,yousa):\n li.append(yousa)\n return li\n \ndef main():\n res=0\n n,m=map(int,input().split())\n h=list(map(int,input().split()))\n \n a=[list(map(int,input().split())) for i in range(m)]\n f=[]\n for i in range(n):\n f.append([0])\n for i in a:\n f[i[0]-1].append(h[i[1]-1])\n f[i[1]-1].append(h[i[0]-1])\n p=-1\n for i in f:\n p+=1\n if len(i)==1:\n res+=1\n elif ma(i)<h[p]:\n res+=1\n else:\n continue\n\n print(res)\n\nif __name__ == '__main__':\n main()"]
|
['Wrong Answer', 'Accepted']
|
['s663135748', 's557871931']
|
[9176.0, 44120.0]
|
[25.0, 412.0]
|
[685, 724]
|
p02689
|
u214515556
| 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 = int(input())\nW = [int(input()) for _ in range(N)]\nD = [W[0]]\n\nfor i in range ( 1 , N ):\n b = W[i]\n if max(D) < b:\n D.append(b)\n else:\n for j in range ( len ( D )):\n if D[j] >= b:\n D[j] = b\n break\n\nprint ( len ( D ))', 'import math\nA, B, N = map(int, input().split())\n\narr = []\nfor num in range(N):\n\n ans = math.floor((A * N) / B) - A * math.floor(N / B)\n arr.append(ans)\n\narr.sort()\n\nprint(arr[len(arr) - 1])', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\n\nall_tenbo = list(range(1, N+1))\nnot_good = []\n\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] <= H[B-1]:\n not_good.append(A)\n if H[B-1] <= H[A-1]:\n not_good.append(B)\n\nprint(len(list(set(all_tenbo)-set(not_good))))']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s118725285', 's180139648', 's408309101']
|
[9204.0, 9196.0, 29800.0]
|
[21.0, 25.0, 274.0]
|
[289, 191, 324]
|
p02689
|
u216752093
| 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()))\nll=[]\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]<h[b-1]:\n lose=[a]\n elif h[a-1]>h[b-1]:\n lose=[b]\n else:\n lose=[a,b]\n ll += lose\nprint(ll)\nimport collections\nc=collections.Counter(ll)\nprint(n-len(c))', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\nll=[]\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]<h[b-1]:\n lose=[a]\n elif h[a-1]>h[b-1]:\n lose=[b]\n else:\n lose=[a,b]\n ll += lose\n\nimport collections\nc=collections.Counter(ll)\nprint(n-len(c))']
|
['Wrong Answer', 'Accepted']
|
['s055380281', 's374301355']
|
[22432.0, 22160.0]
|
[257.0, 278.0]
|
[314, 305]
|
p02689
|
u218757284
| 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 = [1 for _ in range(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:\n l[a - 1] = 0\n else:\n l[a - 1] = 0\n l[b - 1] = 0\n\ncnt = 0\nfor i in l:\n if i == 1:\n cnt += 1\n\nprint(cnt)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = [1 for _ in range(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 else:\n l[a - 1] = 0\n l[b - 1] = 0\n\ncnt = 0\nfor i in l:\n if i == 1:\n cnt += 1\n\nprint(cnt)']
|
['Runtime Error', 'Accepted']
|
['s509400715', 's406897529']
|
[8972.0, 20064.0]
|
[23.0, 266.0]
|
[314, 330]
|
p02689
|
u218834617
| 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\nN,M=map(int,input().split())\nH=list(map(int,input().split()))\n\nprint(N,M,H)\n\nbad=set()\nfor ln in sys.stdin:\n A,B=map(int,ln.split())\n x,y=H[A-1],H[B-1]\n if x>y:\n bad.add(y)\n elif x<y:\n bad.add(x)\n else:\n bad.add(x)\n bad.add(y)\n\nprint(N-len(bad))\n', 'import sys\nN,M=map(int,input().split())\nH=list(map(int,input().split()))\n\n#print(N,M,H)\n\nbad=set()\nfor ln in sys.stdin:\n A,B=map(int,ln.split())\n x,y=H[A-1],H[B-1]\n if x>y:\n bad.add(B)\n elif x<y:\n bad.add(A)\n else:\n bad.add(A)\n bad.add(B)\n\nprint(N-len(bad))\n']
|
['Wrong Answer', 'Accepted']
|
['s782500793', 's170431758']
|
[20032.0, 19656.0]
|
[156.0, 164.0]
|
[300, 301]
|
p02689
|
u220499476
| 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())\ns = list(map(int,input().split()))\na = []*m\nb = []*m\nans = 0\nfor __ in range(m):\n _= list(map(int, input().split()))\n a.append(_)\n if s[_[0]-1] > s[_[1]-1]:\n b.append(_[0])\n elif s[_[0]-1] < s[_[1]-1]:\n b.append(_[1])\n else:\n b.append(0)\nfor i in range(n):\n count = 0\n for j in range(m):\n if i+1 in a[j]:\n count += 1\n if b.count(i+1) == count:\n ans += 1\n print(str(i+1) +" is good")\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)', 'n, m =map(int,input().split())\ns = list(map(int,input().split()))\nt = [0]*n \nfor __ in range(m):\n a, b =map(int,input().split())\n if s[a-1] >= s[b-1]:\n t[b-1] += 1\n if s[a-1] <= s[b-1]:\n t[a-1] += 1\nprint(t.count(0))\n ']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s415873990', 's617874832', 's736034363']
|
[33492.0, 29448.0, 20016.0]
|
[2206.0, 346.0, 263.0]
|
[459, 511, 251]
|
p02689
|
u222668979
| 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 = map(int, input().split())\nh = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(m)]\n\nh_max = [0 for _ in range(n)]\nfor a, b in ab:\n h_max[a-1] = max(h_max[a-1], h[b-1])\n h_max[b-1] = max(h_max[b-1], h[a-1])\n\ncnt = 0\nfor i in range(n):\n if h[i] > h_max:\n cnt += 1\nprint(cnt)\n', 'import sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(m)]\n\nh_max = [0 for _ in range(n)]\nfor a, b in ab:\n h_max[a-1] = max(h_max[a-1], h[b-1])\n h_max[b-1] = max(h_max[b-1], h[a-1])\n\ncnt = 0\nfor i in range(n):\n if h[i] > h_max[i]:\n cnt += 1\nprint(cnt)\n']
|
['Runtime Error', 'Accepted']
|
['s397473413', 's686504287']
|
[31924.0, 31896.0]
|
[257.0, 261.0]
|
[371, 374]
|
p02689
|
u224119985
| 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\nl=[0]*n\ncount=0\nfor i in range(m):\n a[i], b[i]=map(int, input().split())\n l[a-1]=max(l[a-1],h[b-1])\n l[b-1]=max(l[b-1],h[a-1])\nfor i in range(n):\n if h[i]>l[i]:\n count=count+1\nprint(count)', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nl = [0]*n\n \nfor i in range(m):\n a, b = map(int, input().split())\n l[a-1] = max(l[a-1], h[b-1])\n l[b-1] = max(l[b-1], h[a-1])\n \ncount = 0\nfor i in range(n):\n if h[i] > l[i]:\n count += 1\n \nprint(count)']
|
['Runtime Error', 'Accepted']
|
['s367281900', 's745116066']
|
[20072.0, 20080.0]
|
[43.0, 316.0]
|
[293, 287]
|
p02689
|
u224554402
| 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()))\nheight_list = list(map(int, input().split()))\nroads = [list(map(int, input().split())) for _ in range(m)]\ncount = 0\nfor i in range(n):\n neibor_list =[]\n for i_road, road in enumerate(roads):\n if i == road[0]:\n neibor_list.append(road[1])\n elif i == road[1]:\n neibor_list.append(road[0])\n print(i, neibor_list)\n if neibor_list ==[]:\n count +=1\n else:\n neibor_high = [height_list[l-1] for l in neibor_list]\n if max(neibor_high) < height_list[i]:\n count +=1\n \nprint(count)', 'n,m = list(map(int, input().split()))\nheight_list = list(map(int, input().split()))\nl=[1]*n\nfor i in range(m):\n a,b = map(int,input().split())\n if height_list[a-1] > height_list[b-1]:\n l[b-1] =0\n elif height_list[a-1] < height_list[b-1]:\n l[a-1]= 0\n else:\n l[a-1]=l[b-1] =0\nprint(sum(l))']
|
['Wrong Answer', 'Accepted']
|
['s456556255', 's285476249']
|
[31388.0, 20108.0]
|
[2207.0, 253.0]
|
[597, 320]
|
p02689
|
u227085629
| 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 = [list(map(int,input().split())) for nesya in range(m)]\nk = [1]*n\nfor route in x:\n h1 = route[0]-1\n h2 = route[1]-1\n if h[h1] < h[h2]:\n k[h1] = 0\n elif h[h1] > h[h2]\n k[h2] = 0\nprint(sum(k))', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\nx = [list(map(int,input().split())) for nesya in range(m)]\nk = [1]*n\nfor route in x:\n h1 = route[0]-1\n h2 = route[1]-1\n if h[h1] < h[h2]:\n k[h1] = 0\n elif h[h1] > h[h2]:\n k[h2] = 0\n else:\n k[h1] = 0\n k[h2] = 0\nprint(sum(k))']
|
['Runtime Error', 'Accepted']
|
['s510354576', 's098440143']
|
[9044.0, 32004.0]
|
[21.0, 302.0]
|
[269, 306]
|
p02689
|
u228232845
| 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?
|
["from collections import deque\nimport numpy as np\n\nclass Graph:\n def __init__(self, n, directed=False):\n self.graph = [deque([]) for _ in range(n)]\n self.directed = directed\n\n def add_edge(self, u, v):\n self.graph[u].append(v)\n if not self.directed: self.graph[v].append(u)\n\n def bfs(self, start):\n visited = [False for _ in range(len(self.graph))]\n queue = deque([start])\n good = 0\n \n visited[start] = True\n \n while queue:\n v = queue.popleft()\n gflag = True\n # print(f'v: {v}')\n for i in self.graph[v]:\n if not visited[i]:\n queue.append(i)\n visited[i] = True\n if h[v] < h[i]:\n gflag = False\n break\n if gflag: good += 1\n return good\n\nif __name__ == '__main__':\n n , m = map(int, input().split())\n *h, = map(int, input().split())\n h_s = np.sort(np.array(h))[-1::-1]\n h_ind = np.argsort(h)[-1::-1]\n # print(h_s)\n # print(h_ind)\n g = Graph(n)\n # a = []\n # b = []\n # d = {}\n for _ in range(m):\n ai, bi = map(int, input().split())\n g.add_edge(ai - 1, bi - 1)\n # a.append(ai)\n # b.append(bi)\n # print(g.graph)\n ans = g.bfs(h_ind[0])\n print(ans)\n \n \n", 'from collections import defaultdict\n\n\nn, m = map(int, input().split())\n*h, = map(int, input().split())\nd = defaultdict(list)\nfor i in range(m):\n a, b = map(int, input().split())\n d[a - 1].append(b - 1)\n d[b - 1].append(a - 1)\n# print(d)\nans = 0\n\nfor i in range(n):\n is_good = True\n for lighthouse in d[i]:\n # print(f"{i}: {h[i]} vs. {lighthouse}: {h[lighthouse]}")\n if h[i] > h[lighthouse]:\n continue\n is_good = False\n # print(f"{i} is not good.")\n break\n\n if is_good:\n # print(f"{i} is good.")\n ans += 1\n\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s389056714', 's577810040']
|
[103416.0, 39648.0]
|
[589.0, 410.0]
|
[1388, 594]
|
p02689
|
u233183615
| 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\n\nN,M=map(int,input().split())\nH=list(map(int,input().split()))\nA=[list(map(int,input().split())) for i in range(M)]\n\nok=np.ones(N)\nfor i in range(M):\n if H[A[i][0]-1]>H[A[i][1]-1]:\n ok[A[i][0]-1]=1\n ok[A[i][1]-1]=0\n elif H[A[i][0]-1]==H[A[i][1]-1]:\n ok[A[i][0]-1]=0\n ok[A[i][1]-1]=0\n else:\n ok[A[i][1]-1]=1\n ok[A[i][0]-1]=0\n print(ok)\nprint(int(np.sum(ok)))', 'import numpy as np\n\nN,M=map(int,input().split())\nH=list(map(int,input().split()))\nA=[list(map(int,input().split())) for i in range(M)]\n\nok=np.ones(N)\nfor i in range(M):\n if H[A[i][0]-1]>H[A[i][1]-1]:\n ok[A[i][1]-1]=0\n elif H[A[i][0]-1]==H[A[i][1]-1]:\n ok[A[i][0]-1]=0\n ok[A[i][1]-1]=0\n else:\n ok[A[i][0]-1]=0\nprint(int(np.sum(ok)))']
|
['Wrong Answer', 'Accepted']
|
['s146504916', 's204101825']
|
[50736.0, 50164.0]
|
[2207.0, 412.0]
|
[430, 368]
|
p02689
|
u236795403
| 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?
|
['a = input().split(" ")\nN = eval(a[0])\nM = eval(a[1])\nb = input().split(" ")\nhight_lst = list(map(eval, b))\nlst = []\nfor i in range(N):\n lst.append([])\n\nfor i in range(M):\n c = input().split(" ")\n lst[eval(c[0])-1].append(eval(c[1])-1)\n lst[eval(c[1])-1].append(eval(c[0])-1)\n \ncount = 0\nfor i in range(0, N):\n if lst[i] == []:\n count += 1\n else:\n for j in lst[i]:\n if hight_lst[j] >= hight_lst[i]:\n break\n count += 1\n\nprint(count)', 'a = input().split(" ")\nN = eval(a[0])\nM = eval(a[1])\nb = input().split(" ")\nhight_lst = list(map(eval, b))\nlst = []\nfor i in range(N):\n lst.append(1)\nfor i in range(M):\n c = input().split(" ")\n c1 = eval(c[0]) - 1\n c2 = eval(c[1]) - 1\n if hight_lst[c1] > hight_lst[c2]:\n lst[c2] = 0\n elif hight_lst[c1] < hight_lst[c2]:\n lst[c1] = 0\n else:\n lst[c1] = 0\n lst[c2] = 0\ncount = 0\nfor i in lst:\n if i == 1:\n count += 1\n\nprint(count)']
|
['Wrong Answer', 'Accepted']
|
['s608135587', 's810641029']
|
[36360.0, 20904.0]
|
[2023.0, 1283.0]
|
[502, 486]
|
p02689
|
u238084414
| 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 = []\ncnt = 0\nfor i in range(M):\n a, b = map(int, input().split())\n ab = sorted([a, b])\n if AB.count(ab) == 0:\n AB.append(ab)\nprint(AB)\nfor i in range(1, N+1):\n flag = True\n for ab in AB:\n if ab[0] == i:\n x = ab[1]\n if H[i - 1] <= H[x - 1]:\n flag = False\n AB.remove(ab)\n break\n elif ab[1] == i:\n x = ab[0]\n if H[i - 1] <= H[x - 1]:\n flag = False\n break\n if flag:\n cnt += 1\n \nprint(cnt)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nm = [0] * N\ncnt = 0\n\nfor _ in range(M):\n a, b = map(int, input().split())\n m[a - 1] = max(m[a - 1], H[b - 1])\n m[b - 1] = max(m[b - 1], H[a - 1])\n\nfor i in range(N):\n if H[i] > m[i] or m[i] == 0:\n cnt += 1\n\nprint(cnt)']
|
['Wrong Answer', 'Accepted']
|
['s557889325', 's674058937']
|
[20124.0, 20096.0]
|
[2206.0, 330.0]
|
[534, 293]
|
p02689
|
u241348301
| 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()))\nfinal=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]<h[b-1]:\n final[a-1]=0\n elif h[a-1]>h[b-1]:\n final[b-1]= 0\n else:\n final[a-1]=0\n final[b-1]=0\n\nprint(sum(final))\n', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\nfinal=[0]*n\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]<h[b-1]:\n final[a-1]=0\n elif h[a-1]>h[b-1]:\n final[b-1]= 0\n else:\n final[a-1]=0\n final[b-1]=0\n\nprint(sum(final))', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\nfinal=[1]*n\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]<h[b-1]:\n final[a-1]=0\n elif h[a-1]>h[b-1]:\n final[b-1]= 0\n else:\n final[a-1]=0\n final[b-1]=0\n\nprint(sum(final))\n', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\nfinal=[1]*n\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]<h[b-1]:\n final[a-1]=0\n elif h[a-1]>h[b-1]:\n final[b-1]=0\n else:\n final[a-1]=0\n final[b-1]=0\n\nprint(sum(final))\n']
|
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
|
['s201169886', 's540595261', 's640876377', 's578296789']
|
[8952.0, 9048.0, 8960.0, 20048.0]
|
[26.0, 26.0, 23.0, 252.0]
|
[288, 287, 288, 281]
|
p02689
|
u242580186
| 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\nimport time\nimport math\nimport itertools as it\ndef inpl():\n return list(map(int, input().split()))\nst = time.perf_counter()\n# ------------------------------\n\nN, M = inpl()\nH = inpl()\ndp = [True] * M\nfor _ in range(M):\n A, B = inpl()\n if H[A-1] > H[B-1]:\n dp[B-1] = False\n elif H[A-1] < H[B-1]:\n dp[A-1] = False\n else:\n dp[A-1] = False\n dp[B-1] = False\nans = 0\nfor i in dp:\n if i == True:\n ans += 1\nprint(ans)\n\n# ------------------------------\ned = time.perf_counter()\nprint('time:', ed-st, file=sys.stderr)\n", "import sys\nimport time\nimport math\nimport itertools as it\ndef inpl():\n return list(map(int, input().split()))\nst = time.perf_counter()\n# ------------------------------\n\nN, M = inpl()\nH = inpl()\ndp = [True] * N\nfor _ in range(M):\n A, B = inpl()\n if H[A-1] > H[B-1]:\n dp[B-1] = False\n elif H[A-1] < H[B-1]:\n dp[A-1] = False\n else:\n dp[A-1] = False\n dp[B-1] = False\nans = 0\nfor i in dp:\n if i:\n ans += 1\nprint(ans)\n\n# ------------------------------\ned = time.perf_counter()\nprint('time:', ed-st, file=sys.stderr)\n"]
|
['Runtime Error', 'Accepted']
|
['s433623448', 's018737626']
|
[20232.0, 20108.0]
|
[275.0, 276.0]
|
[571, 563]
|
p02689
|
u246907970
| 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\n\ninp=input().split(" ")\nn=int(inp[0])\nm=int(inp[1])\ninh=input().split(" ")\nfor i in range(len(inh)):\n inh[i]=int(inh[i])\npairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)\nfor i in range(m):\n a=input().split(" ")\n pairs[i][0]=int(a[0])\n pairs[i][1]=int(a[1])\nlists=[[] for i in range(n+1)]\nfor i in range(len(pairs)):\n lists[pairs[i][0]-1].append(pairs[i][1]-1)\n lists[pairs[i][1]-1].append(pairs[i][0]-1)\nfor i in range(len(lists)):\n lists[i]=list(set(lists[i]))\ncount=0\nfor i in range(len(lists)):\n if len(lists[i])==0:\n count+=1\n print(i)\n continue\n for j in range(len(lists[i])):\n if inh[i] <= inh[lists[i][j]]:\n break\n if j == len(lists[i]):\n count+=1\n print(i)\nprint(count)', 'import numpy\n\ninp=input().split(" ")\nn=int(inp[0])\nm=int(inp[1])\ninh=input().split(" ")\nfor i in range(len(inh)):\n inh[i]=int(inh[i])\npairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)\nfor i in range(m):\n a=input().split(" ")\n pairs[i][0]=int(a[0])\n pairs[i][1]=int(a[1])\nlists=[[] for i in range(n)]\nfor i in range(len(pairs)):\n lists[pairs[i][0]-1].append(pairs[i][1])\n lists[pairs[i][1]-1].append(pairs[i][0])\nfor i in range(len(lists)):\n lists[i]=set(lists[i])\ncount=0\nfor i in range(len(lists)):\n if len(list[i])==0:\n count+=1\n continue\n for j in range(len(list[i])):\n if inh[i] <= inh[list[i][j]]:\n break\n if j == len(list[i])-1:\n count+=1\nprint(count)\n ', 'import numpy\n\ninp=input().split(" ")\nn=int(inp[0])\nm=int(inp[1])\ninh=input().split(" ")\nfor i in range(len(inh)):\n inh[i]=int(inh[i])\npairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)\nfor i in range(m):\n a=input().split(" ")\n pairs[i][0]=int(a[0])\n pairs[i][1]=int(a[1])\nlists=[[] for i in range(n+1)]\nfor i in range(len(pairs)):\n lists[pairs[i][0]-1].append(pairs[i][1])\n lists[pairs[i][1]-1].append(pairs[i][0])\nfor i in range(len(lists)):\n lists[i]=list(set(lists[i]))\ncount=0\nfor i in range(len(lists)):\n if len(lists[i])==0:\n count+=1\n continue\n for j in range(len(lists[i])):\n if inh[i-1] <= inh[lists[i][j]]:\n break\n if j == len(lists[i])-1:\n count+=1\nprint(count)', 'import numpy\n\ninp=input().split(" ")\nn=int(inp[0])\nm=int(inp[1])\ninh=input().split(" ")\nfor i in range(len(inh)):\n inh[i]=int(inh[i])\npairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)\nfor i in range(m):\n a=input().split(" ")\n pairs[i][0]=int(a[0])\n pairs[i][1]=int(a[1])\nlists=[[] for i in range(n+1)]\nfor i in range(len(pairs)):\n lists[pairs[i][0]-1].append(pairs[i][1]-1)\n lists[pairs[i][1]-1].append(pairs[i][0]-1)\nfor i in range(len(lists)):\n lists[i]=list(set(lists[i]))\ncount=0\nfor i in range(len(lists)):\n if len(lists[i])==0:\n count+=1\n continue\n for j in range(len(lists[i])):\n if inh[i] <= inh[lists[i][j]]:\n break\n if j == len(lists[i]):\n count+=1\nprint(count)', 'import numpy\n\ninp=input().split(" ")\nn=int(inp[0])\nm=int(inp[1])\ninh=input().split(" ")\nfor i in range(len(inh)):\n inh[i]=int(inh[i])\npairs=numpy.zeros(2*m,dtype=">i4").reshape(-1,2)\nfor i in range(m):\n a=input().split(" ")\n pairs[i][0]=int(a[0])\n pairs[i][1]=int(a[1])\nlists=[[] for i in range(n)]\nfor i in range(len(pairs)):\n lists[pairs[i][0]-1].append(pairs[i][1]-1)\n lists[pairs[i][1]-1].append(pairs[i][0]-1)\nfor i in range(len(lists)):\n lists[i]=list(set(lists[i]))\ncount=0\nfor i in range(len(lists)):\n if len(lists[i])==0:\n count+=1\n continue\n for j in range(len(lists[i])):\n if inh[i] <= inh[lists[i][j]]:\n break\n if j == len(lists[i])-1:\n count+=1\nprint(count)']
|
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
|
['s127045568', 's131578234', 's189833693', 's565802456', 's432257254']
|
[50856.0, 66652.0, 50856.0, 50772.0, 50744.0]
|
[1488.0, 989.0, 1098.0, 1506.0, 1446.0]
|
[729, 690, 701, 701, 701]
|
p02689
|
u247830763
| 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())\nls = list(map(int,input().split()))\ndir = [list(map(int,input().split())) for _ in range(m)]\nk = 0\np = 0\nfor i in range(1,n+1):\n new = [e for e in dir if i in e]\n print(new)\n if new == []:\n k += 1\n else:\n for j in range(len(new)):\n if new[j][0] != i:\n (new[j][0],new[j][1]) = (new[j][1],new[j][0])\n print(new[j])\n if ls[new[j][0]-1]>ls[new[j][1]-1]:\n p += 1\n if p == len(new):\n k += 1\n p = 0\nprint(k)\n \n', 'n,m = map(int,input().split())\nls = list(map(int,input().split()))\npos = [1]*(n)\nfor i in range(m):\n a,b = map(int,input().split())\n if ls[a-1] > ls[b-1]:\n pos[b-1] = 0\n elif ls[a-1] < ls[b-1]:\n pos[a-1] = 0\n else:\n pos[a-1] = 0\n pos[b-1] = 0\nprint(sum(pos))']
|
['Wrong Answer', 'Accepted']
|
['s883986659', 's861834310']
|
[31152.0, 19940.0]
|
[2207.0, 250.0]
|
[575, 298]
|
p02689
|
u252964975
| 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())\nyoi = []\nfor i in range(N):\n yoi.append(True)\nH=list(map(int, input().split()))\nfor i in ranage(M):\n A,B=map(int, input().split())\n if H[A-1]<=H[B-1]: yoi[A-1]=False\n if H[B-1]<=H[A-1]: yoi[B-1]=False \nprint(len([1 for x in yoi if x==True]))', 'N,M=map(int, input().split())\nyoi = []\nfor i in range(N):\n yoi.append(True)\nH=list(map(int, input().split()))\nfor i in range(M):\n A,B=map(int, input().split())\n if H[A-1]<=H[B-1]: yoi[A-1]=False\n if H[B-1]<=H[A-1]: yoi[B-1]=False \nprint(len([1 for x in yoi if x==True]))']
|
['Runtime Error', 'Accepted']
|
['s772762087', 's997924583']
|
[20876.0, 20800.0]
|
[50.0, 270.0]
|
[275, 274]
|
p02689
|
u257265865
| 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=[1]*m\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]>h[b-1]:\n count[b-1]=0\n elif h[a-1]==h[b-1]:\n count[a-1]=0\n count[b-1]=0\n else:\n count[b-1]=0\nprint(sum(count))\n ', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\ncount=[1]*n\nfor i in range(m):\n a,b=map(int,input().split())\n if h[a-1]>h[b-1]:\n count[b-1]=0\n elif h[a-1]==h[b-1]:\n count[a-1]=0\n count[b-1]=0\n else:\n count[a-1]=0\nprint(sum(count))\n \n']
|
['Runtime Error', 'Accepted']
|
['s222509945', 's856769005']
|
[19932.0, 20060.0]
|
[251.0, 241.0]
|
[265, 266]
|
p02689
|
u260036763
| 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()))\nma = [0]*(N+1)\ncnt = 0\nfor _ in range(M):\n a, b = map(int, input().split())\n ma[a] = max(ma[a], H[b-1])\n ma[b] = max(H[a-1], ma[b])\nfor i in range(1, N+1):\n if H[i] > ma[i]:\n cnt += 1\nprint(cnt)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nl = [[0] for _ in range(N+1)]\ncnt = 0\nfor _ in range(M):\n a, b = map(int, input().split())\n l[a].append(H[b-1])\n l[b].append(H[a-1])\nfor i in range(1, N+1):\n if H[i-1] > max(l[i]):\n cnt += 1\nprint(cnt)']
|
['Runtime Error', 'Accepted']
|
['s563334519', 's002875926']
|
[20124.0, 25924.0]
|
[322.0, 391.0]
|
[282, 289]
|
p02689
|
u262065571
| 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 = list(range(1,N+1))\nfor i in range(M):\n ai, bi = map(int, input().split())\n if H[ai+1] < H[bi+1] :\n a.remove(ai)\n else:\n a.remove(bi)\nprint(len(a)) \n ', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\na = []\n[a.append(i) for i in range(1,N+1)]\nfor i in range(M):\n ai, bi = map(int, input().split())\n if H[ai+1] < H[bi+1] :\n a.remove(ai)\n else:\n a.remove(bi)\nprint(len(a)) \n ', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\na = list(range(1,N+1))\nfor i in range(M):\n ai, bi = map(int, input().split())\n if H[ai-1] <= H[bi-1] :\n a.remove(ai)\n if H[ai-1] >= H[bi-1]:\n a.remove(bi)\nprint(len(a)) \n ', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\na = []\n[a.append(i) for i in range(1,N+1)]\nfor i in range(M):\n ai, bi = map(int, input().split())\n if ai < bi:\n a.remove(ai)\n else:\n a.remove(bi)\nprint(len(a)) \n ', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\na = list(range(1,N+1))\nfor i in range(M):\n ai, bi = map(int, input().split())\n if H[ai-1] < H[bi-1] :\n a.remove(ai)\n else:\n a.remove(bi)\nprint(len(a)) \n ', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\na = [True] * N\nfor i in range(M):\n ai, bi = map(int, input().split())\n if H[ai-1] <= H[bi-1] :\n a[ai-1] = False\n if H[ai-1] >= H[bi-1]:\n a[bi-1] = False\nprint(sum(a)) \n ']
|
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
|
['s033201668', 's136748696', 's463649110', 's735023431', 's788467982', 's935795137']
|
[20000.0, 19976.0, 20096.0, 20092.0, 20124.0, 20156.0]
|
[417.0, 426.0, 323.0, 358.0, 325.0, 261.0]
|
[235, 255, 253, 244, 235, 251]
|
p02689
|
u264113350
| 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\n\nN,M = [int(i) for i in input().split(" ")]\nH = [int(i) for i in input().split(" ")]\nmh = np.zeros([N])\nfor i in range(M):\n a,b = [int(i)-1 for i in input().split(" ")]\n mh[a] = max(mh[a],h[b])\n mh[b] = max(mh[b],h[a])\n\nans = 0\nfor i in range(N):\n if mh[i] < h[i]:\n ans += 1\n\nprint(ans)', 'import numpy as np\n\nN,M = [int(i) for i in input().split(" ")]\nH = [int(i) for i in input().split(" ")]\nmh = np.zeros([N])\nfor i in range(M):\n a,b = [int(i)-1 for i in input().split(" ")]\n mh[a] = max(mh[a],H[b])\n mh[b] = max(mh[b],H[a])\n\nans = 0\nfor i in range(N):\n if mh[i] < H[i]:\n ans += 1\n\nprint(ans)']
|
['Runtime Error', 'Accepted']
|
['s402634282', 's380497909']
|
[38484.0, 38684.0]
|
[144.0, 498.0]
|
[324, 324]
|
p02689
|
u264281836
| 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?
|
['height=list(map(int,input().strip().split()) )\nlst=[1]*h\n\nfor i in range(m):\n a,b=map(int,input().strip().split())\n if height[a-1]>height[b-1]:\n lst[a-1]=1\n lst[b-1]=0\n elif height[a-1]<height[b-1]:\n lst[b-1]=1\n lst[a-1]=0\n else:\n lst[b - 1] = 0\n lst[a - 1] = 0\nprint(lst.count(1))', 'h, m =map(int,input().strip().split())\n\nheight=list(map(int,input().strip().split()) )\nlst=[1]*h\n\nfor i in range(m):\n a,b=map(int,input().strip().split())\n if height[a-1]>height[b-1]:\n lst[b-1]=0\n elif height[a-1]<height[b-1]:\n lst[a-1]=0\n else:\n lst[b - 1] = 0\n lst[a - 1] = 0\nprint(lst)\nprint(lst.count(1))', 'h, m =map(int,input().strip().split())\n\nheight=list(map(int,input().strip().split()) )\nlst=[1]*h\n\nfor i in range(m):\n a,b=map(int,input().strip().split())\n if height[a-1]>height[b-1]:\n lst[b-1]=0\n elif height[a-1]<height[b-1]:\n lst[a-1]=0\n else:\n lst[b - 1] = 0\n lst[a - 1] = 0\n\nprint(lst.count(1))']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s080286258', 's977215612', 's887602085']
|
[9216.0, 20124.0, 19980.0]
|
[24.0, 265.0, 252.0]
|
[335, 348, 338]
|
p02689
|
u266014018
| 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())\nH = np.array([0] + list(map(int,input().split())))\nA , B = [0]*M,[0]*M\nfor i in range(M):\n A[i],B[i] = map(int,input().split())\nadj = [[] for _ in range(N+1)]\n\nfor a,b in zip(A,B):\n adj[a] += [b]\n adj[b] += [a]\n\n# stack = [1]\n# while stack:\n# node = stack.pop()\n# l = adj[node]\n# cand = np.argmax(H[node,l])\ncache = [0]\nans = 0\nfor i in range(1,N+1):\n if i in cache:\n continue\n ind = np.array([i] + adj[i])\n cand = np.argsort(H[ind])[::-1]\n cand = ind[cand]\n if i == cand[0]:\n ans +=1\n cache=np.concatenate((cache,cand[1:]),axis=None)\nprint(ans)', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\nma = [0]*(n)\nfor i in range(n):\n a,b = map(lambda x: int(x)-1,input().split())\n ma[a] = max(ma[a], h[b])\n ma[b] = max(h[a], ma[b])\nans = 0\nfor i in range(n):\n if h[i]>ma[i]:\n ans+=1\nprint(ans)', "def main():\n import sys\n def input(): return sys.stdin.readline().rstrip()\n n, m = map(int, input().split())\n h = list(map(int, input().split()))\n height = [0]*n\n for i in range(m):\n a, b = map(lambda x: int(x)-1, input().split())\n height[a] = max(height[a], h[b])\n height[b] = max(height[b], h[a])\n \n count = 0\n for i, j in zip(h, height):\n if i > j:\n count += 1\n print(count)\n\nif __name__ == '__main__':\n main()"]
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s020905881', 's709119454', 's815361858']
|
[47672.0, 20120.0, 19920.0]
|
[2207.0, 328.0, 198.0]
|
[648, 265, 485]
|
p02689
|
u268183312
| 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\n\nn, m = map(int, input().split())\nhlist = np.array(list(map(int, input().split()))).astype(np.int64)\nab = [list(map(int, input().split())) for _ in range(m)]\n', 'import numpy as np\n\nn, m = map(int, input().split())\nhlist = np.array(list(map(int, input().split()))).astype(np.int64)\nab = [list(map(int, input().split())) for _ in range(m)]\nconnect = np.zeros((n,n)).astype(np.int64)', 'import numpy as np\n\nn, m = map(int, input().split())\nhlist = np.array(list(map(int, input().split()))).astype(np.int64)\nab = [list(map(int, input().split())) for _ in range(m)]\nconnect = np.zeros((n,n)).astype(np.int64)\nfor a, b in ab:\n connect[a-1, b-1] = 1\n connect[b-1, a-1] = 1\nans = 0\n\n# if (connect[i] * hlist >= hlist[i]).sum() == 0:\n# ans += 1\n#print(ans)', 'n, m = map(int, input().split())\nhlist = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(m)]\n\nmaxh = [0]*n\nfor a, b in ab:\n maxh[a-1] = max(maxh[a-1], hlist[b-1])\n maxh[b-1] = max(maxh[b-1], hlist[a-1])\nans = 0\nfor i in range(n):\n if maxh[i] < hlist[i]:\n ans += 1\nprint(ans)']
|
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
|
['s223629071', 's889548796', 's964239530', 's770931782']
|
[46632.0, 46700.0, 46680.0, 31896.0]
|
[337.0, 330.0, 327.0, 359.0]
|
[177, 219, 388, 317]
|
p02689
|
u268724304
| 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 = map(int, input().split())\nH = list(map(int, input().split()))\nC = [0]*N\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 H[B-1]=H[A-1]\n if H[A-1] < H[B-1]:\n C[A-1]=1\n H[A-1]=H[B-1]\n if H[A-1] == H[B-1]:\n if C[A-1]==1:\n C[B-1] = 1\n if C[B-1]==1:\n C[A-1] = 1\n\n\nprint("{}".format(N-sum(C)))', '# -*- coding: utf-8 -*-\n\nN, M = map(int, input().split())\nH = list(map(int, input().split()))\nC = [0]*N\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\n if H[A-1] <= H[B-1]:\n C[A-1]=1\n \n if H[A-1] == H[B-1]:\n if C[A-1]==1:\n C[B-1] = 1\n if C[B-1]==1:\n C[A-1] = 1\n\n\nprint("{}".format(N-sum(C)))']
|
['Wrong Answer', 'Accepted']
|
['s685122481', 's742626523']
|
[20068.0, 20028.0]
|
[318.0, 274.0]
|
[432, 400]
|
p02689
|
u274758786
| 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 = [1]*n\nmax = 0\nfor i in range(m):\n a, b = map(int(input().split()))\n if h[a-1] <= h[b-1]:\n p[a-1] = 0\n if h[a-1] >= h[b-1]:\n p[b-1] = 0\nprint(sum(p))', 'n, m = map(int, (input().split()))\nh = list(map(int, input().split()))\np = [1]*n\nmax = 0\nfor i in range(m):\n a, b = map(int, (input().split()))\n if h[a-1] <= h[b-1]:\n p[a-1] = 0\n if h[a-1] >= h[b-1]:\n p[b-1] = 0\nprint(sum(p))\n']
|
['Runtime Error', 'Accepted']
|
['s484439755', 's946964969']
|
[9128.0, 20076.0]
|
[23.0, 273.0]
|
[244, 249]
|
p02689
|
u277104886
| 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 = []\nfor j in range(m):\n a = list(map(int, input().split()))\n s = a[0] - 1\n t = a[1] - 1\n if h[s] <= h[t]:\n x.append(t)\n else\n x.append(s)\n\nprint(len(set(x))) \n\n ', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nx = [0 for _ in range(n)]\nfor j in range(m):\n a = list(map(int, input().split()))\n s = a[0] - 1\n t = a[1] - 1\n if h[s] < h[t]:\n x[s] = 1\n elif h[s] > h[t]:\n x[t] =1\n else:\n x[s] = 1\n x[t] = 1\n\nprint(x.count(0)) \n\n ']
|
['Runtime Error', 'Accepted']
|
['s184729911', 's309298251']
|
[8852.0, 20032.0]
|
[24.0, 281.0]
|
[272, 339]
|
p02689
|
u282652245
| 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\ndef main():\n NM = list(map(int,input().split()))\n H = list(map(int,input().split()))\n\n \n\n Judge = [True] * NM[0]\n\n for i in range(NM[1]):\n ABi = list(map(int,input().split()))\n\n\n if H[ABi[0]-1] > H[ABi[1]-1]:\n if Judge[ABi[0]-1]:\n Judge[ABi[0]-1] = True\n Judge[ABi[1]-1] = False\n\n elif H[ABi[0]-1] == H[ABi[1]-1]:\n Judge[ABi[0] - 1] = False\n Judge[ABi[1] - 1] = False\n\n else:\n Judge[ABi[0] - 1] = False\n if Judge[ABi[1]-1]:\n Judge[ABi[1] - 1] = True\n\n print(Judge)\n print(Judge.count(True))\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n\n", "\n\ndef main():\n NM = list(map(int,input().split()))\n H = list(map(int,input().split()))\n\n \n\n Judge = [True] * NM[0]\n\n for i in range(NM[1]):\n ABi = list(map(int,input().split()))\n\n\n if H[ABi[0]-1] > H[ABi[1]-1]:\n if Judge[ABi[0]-1]:\n Judge[ABi[0]-1] = True\n Judge[ABi[1]-1] = False\n\n elif H[ABi[0]-1] == H[ABi[1]-1]:\n Judge[ABi[0] - 1] = False\n Judge[ABi[1] - 1] = False\n\n else:\n Judge[ABi[0] - 1] = False\n if Judge[ABi[1]-1]:\n Judge[ABi[1] - 1] = True\n\n # print(Judge)\n print(Judge.count(True))\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n\n"]
|
['Wrong Answer', 'Accepted']
|
['s844653425', 's267955135']
|
[20112.0, 20140.0]
|
[278.0, 273.0]
|
[749, 751]
|
p02689
|
u285265363
| 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 _ in range(m)]\nans = [1]*n\nfor i in range(m):\n if h[ab[i][0]-1] == h[ab[i][1]-1]:\n ans[ab[i][0]-1] = 0\n ans[ab[i][1]-1] = 0\n elif h[ab[i][0]-1] > h[ab[i][1]]:\n ans[ab[i][1]-1] = 0\n else:\n ans[ab[i][0]-1] = 0\nprint(sum(ans))\n', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(m)]\nans = [1]*n\nfor i in range(m):\n if h[ab[i][0]-1] == h[ab[i][1]-1]:\n ans[ab[i][0]-1] = 0\n ans[ab[i][1]-1] = 0\n elif h[ab[i][0]-1] > h[ab[i][1]-1]:\n ans[ab[i][1]-1] = 0\n else:\n ans[ab[i][0]-1] = 0\nprint(sum(ans))\n']
|
['Runtime Error', 'Accepted']
|
['s090148564', 's473246876']
|
[31848.0, 31952.0]
|
[328.0, 320.0]
|
[372, 374]
|
p02689
|
u294700660
| 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())\npeaks=list(map(int, input().split()))\nflag=[1]*N\na=0\nb=0\nfor i in range(M):\n a,b=map(int,input().split())\n a-=1\n b-=1\n if peaks[a]<=peaks[b]:\n flag[a]=0\n if peaks[a]>=peaks[b]:\n flag[a]=0\nans=0\nfor i in flag:\n ans+=flag[i]\nprint(ans)', 'N,M=map(int, input().split())\npeaks=list(map(int, input().split()))\nflag=[1]*N\na=0\nb=0\nfor i in range(M):\n a,b=map(int,input().split())\n a-=1\n b-=1\n if peaks[a]<=peaks[b]:\n flag[a]=0\n if peaks[a]>=peaks[b]:\n flag[b]=0\nans=0\nfor i in flag:\n ans+=i\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s929354416', 's237272609']
|
[20128.0, 20048.0]
|
[273.0, 269.0]
|
[277, 271]
|
p02689
|
u306060982
| 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()]\nnn = [1]*n\nfor _ in range(m):\n a,b\t= map(int,input().split())\n\n if h[a-1] <\th[b-1]:\n\t\tnn[a-1]=0\n else:\n\t\tnn[b-1]=0\n\nprint(sum(nn))', 'n,m = map(int,input().split())\nh = [int(i) for i in input().split()]\nnn = [[-1]]*n\n\nfor i in range(m):\n a,b = map(int,input().split())\n nn[a-1].append(b-1)\n nn[b-1].append(a-1)\nc=0\nfor i\tin range(n):\n f=0\n for k in nn[i]:\n\tif k==-1:continue\n if h[i] < k:\n f=1\n if f==0:\n\tc+=1\nprint(c)\n', 'n,m = map(int,input().split())\nh = [int(i) for i in input().split()]\nnn = [1]*n\nfor _ in range(m):\n a,b = map(int,input().split())\n if h[a-1] ==h[b-1]:\n nn[a-1]=0\n nn[b-1]=0\n elif h[a-1] < h[b-1]:\n nn[a-1]=0\n else:\n nn[b-1]=0\n\nprint(sum(nn))']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s097211185', 's635731247', 's415306719']
|
[8852.0, 9052.0, 20116.0]
|
[26.0, 23.0, 259.0]
|
[208, 321, 281]
|
p02689
|
u306718299
| 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 -*-\nimport numpy as np\n\nn, m = map(int, input().split())\nh = np.array(input().split(), dtype='int')\nbad_tower = []\n\nfor i in range(m):\n a, b = map(int, input().split())\n ha = h[a-1]\n hb = h[b-1]\n\n if ha > hb:\n bad_tower.append(b)\n elif ha < hb:\n bad_tower.append(a)\n elif ha == hb:\n bad_tower.append(a)\n bad_tower.append(b)\n\nbad_tower = np.unique(bad_tower)\n\nans = n - len(bad_tower) + 1\n\nprint(ans)", "# -*- coding: utf-8 -*-\nimport numpy as np\n\nn, m = map(int, input().split())\nh = np.array(input().split(), dtype='int')\ngood_tower = np.arange(1, n+1)\nbad_tower = np.zeros((), dtype='int')\n\nfor i in range(m):\n way = np.array(input().split(), dtype='int')\n\n if h[way[0]-1] > h[way[1]-1]:\n bad_tower = np.append(bad_tower, way[1])\n elif h[way[0]-1] < h[way[1]-1]:\n bad_tower = np.append(bad_tower, way[0])\n elif h[way[0]-1] == h[way[1]-1]:\n bad_tower = np.append(bad_tower, way[0])\n bad_tower = np.append(bad_tower, way[1])\n\nbad_tower = np.array(list(set(bad_tower)))\n\nans = len(good_tower) - len(bad_tower) - 1\n\nprint(ans)", "# -*- coding: utf-8 -*-\nimport numpy as np\n\nn, m = map(int, input().split())\nh = np.array(input().split(), dtype='int')\nbad_tower = []\n\nfor i in range(m):\n a, b = map(int, input().split())\n ha = h[a-1]\n hb = h[b-1]\n\n if ha > hb:\n bad_tower.append(b)\n elif ha < hb:\n bad_tower.append(a)\n elif ha == hb:\n bad_tower.append(a)\n bad_tower.append(b)\n\nbad_tower = np.unique(bad_tower)\n\nans = n - len(bad_tower)\n\nprint(ans)"]
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s132659123', 's209153595', 's729248957']
|
[40160.0, 40040.0, 40256.0]
|
[366.0, 2206.0, 376.0]
|
[465, 661, 461]
|
p02689
|
u307615746
| 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\nimport copy\n\ndef main():\n N, M = list(map(int, input().split()))\n H = list(map(int, input().split()))\n maxH = np.zeros(N)\n\n for itr in range(M):\n A, B = list(map(int, input().split()))\n if H[A- 1] == H[B- 1] :\n maxH[A- 1] = -1\n maxH[B- 1] = -1\n elif H[A- 1] > H[B- 1] :\n maxH[A- 1] = copy.copy(H[A- 1])\n maxH[B- 1] = copy.copy(H[A- 1])\n elif H[A- 1] < H[B- 1] :\n maxH[A- 1] = copy.copy(H[B- 1])\n maxH[B- 1] = copy.copy(H[B- 1])\n \n result = 0\n for itr in range(N):\n if H[itr] == maxH[itr] or maxH[itr] == 0:\n result += 1\n print(maxH)\n print(result)\n\nif __name__ == "__main__":\n main()\n\n\n', 'import numpy as np\nimport copy\n\ndef main():\n N, M = list(map(int, input().split()))\n H = list(map(int, input().split()))\n maxH = np.zeros(N)\n\n for itr in range(M):\n A, B = list(map(int, input().split()))\n if H[A- 1] == H[B- 1] :\n maxH[A- 1] = copy.copy(H[A- 1]) + 1\n maxH[B- 1] = copy.copy(H[A- 1]) + 1\n elif H[A- 1] > H[B- 1] :\n if maxH[A- 1] < H[A- 1] :\n maxH[A- 1] = copy.copy(H[A- 1])\n if maxH[B- 1] < H[A- 1] :\n maxH[B- 1] = copy.copy(H[A- 1])\n elif H[A- 1] < H[B- 1] :\n if maxH[A- 1] < H[B- 1] :\n maxH[A- 1] = copy.copy(H[B- 1])\n if maxH[B- 1] < H[B- 1] :\n maxH[B- 1] = copy.copy(H[B- 1])\n \n result = 0\n for itr in range(N):\n if H[itr] == maxH[itr] or maxH[itr] == 0:\n result += 1\n #print(maxH)\n print(result)\n\nif __name__ == "__main__":\n main()\n\n\n']
|
['Wrong Answer', 'Accepted']
|
['s159101768', 's279625764']
|
[38680.0, 38604.0]
|
[478.0, 554.0]
|
[753, 962]
|
p02689
|
u313555680
| 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()\nheight = input().split()\nable = []\nfor n in range(int(N)):\n able.append([])\nfor m in range(int(M)):\n con = input().split()\n con[0] = int(con[0])\n con[1] = int(con[1])\n able[con[0]-1].append(con[1])\n able[con[1]-1].append(con[0])\ngood = []\nfor n in range(int(N)):\n if len(able[n]) == 0:\n good.append(n)\n else:\n point = 0\n for a in able[n]:\n if height[n] > height[a-1]:\n point += 1\n if point == len(able[n]):\n good.append(n)\nprint(len(good))\nprint(able)\n', 'N, M = input().split()\nheight = input().split()\nable = []\nfor n in range(int(N)):\n able.append([])\nfor m in range(int(M)):\n con = input().split()\n con[0] = int(con[0]) - 1\n con[1] = int(con[1]) - 1\n able[con[0]].append(height(con[1]))\n able[con[1]].append(height(con[0]))\ngood = []\nfor n in range(int(N)):\n if len(able[n]) == 0:\n good.append(n)\n else:\n if int(height[n]) > max(able[n])\n good.append(n)\nprint(len(good))\n', 'N, M = input().split()\nheight = input().split()\nable = []\nfor n in range(int(N)):\n able.append([])\nfor m in range(int(M)):\n con = input().split()\n con[0] = int(con[0]) - 1\n con[1] = int(con[1]) - 1\n able[con[0]].append(int(height[con[1]]))\n able[con[1]].append(int(height[con[0]]))\ngood = []\nfor n in range(int(N)):\n if len(able[n]) == 0:\n good.append(n)\n else:\n if int(height[n]) > max(able[n]):\n good.append(n)\nprint(len(good))\n']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s211191898', 's536567423', 's692332887']
|
[39248.0, 8880.0, 35584.0]
|
[475.0, 23.0, 447.0]
|
[512, 438, 449]
|
p02689
|
u314837274
| 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))\ncol_list=[[0]*n for _ in range(n)]\ncount=0\nfor _ in range(m):\n a,b=map(int,input().split)\n col_list[a-1][b-1]+=1\n\nfor i in range(n):\n for j in range(n):\n if col_list[i][j]>=1 and h_list[i]<=h_list[j]:\n count+=1\n break\nprint(n-count)\n', 'n,m=map(int,input().split())\nh_list=list(map(int,input().split))\ncol_list=[[0]*n]*n\ncount=0\nfor i in range(m):\n a,b=map(int,input().split)\n col_list[a-1][b-1]+=1\n\nfor i in range(n):\n for j in range(n):\n if col_list[i][j]>=1 and h_list[i]<=h_list[j]:\n count+=1\n break\nprint(n-count)\n', 'n,m=map(int,input().split())\nh_list=list(map(int,input().split()))\nlst=[0]*n\nfor _ in range(m):\n a,b=map(int,input().split())\n if h_list[a-1]<=h_list[b-1]:\n lst[a-1]-=1\n if h_list[a-1]>=h_list[b-1]:\n lst[b-1]-=1\nprint(lst.count(0))']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s129394946', 's883830157', 's104260853']
|
[10984.0, 10980.0, 20016.0]
|
[20.0, 23.0, 265.0]
|
[314, 298, 240]
|
p02689
|
u316649390
| 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 = [0] + H\nTree = [0] + [1]*N\nfor _ in range(M):\n A,B = map(int,input().split())\n if H[A] >= H[B]:\n Tree[B] = 0\n else:\n Tree[A] = 0\nprint(sum(H))', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\nH = [0] + H\nTree = [0] + [1]*N\nfor _ in range(M):\n A,B = map(int,input().split())\n if H[A] > H[B]:\n Tree[B] = 0\n elif H[A] = H[B]:\n Tree[A]=0\n Tree[B]=0\n else:\n Tree[A] = 0\nprint(sum(Tree))', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\nH = [0] + H\nTree = [0]\nfor n in range(N):\n Tree = Tree + [1]\nfor _ in range(M):\n A,B = map(int,input().split())\n if H[A] >= H[B]:\n H[B] = 0\n else:\n H[A] = 0\nprint(sum(H))', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\nH = [0] + H\nTree = [0] + [1]*N\nfor _ in range(M):\n A,B = map(int,input().split())\n if H[A] > H[B]:\n Tree[B] = 0\n elif H[A] == H[B]:\n Tree[A]=0\n Tree[B]=0\n else:\n Tree[A] = 0\nprint(sum(Tree))']
|
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
|
['s458512177', 's525406671', 's580407404', 's713256624']
|
[20148.0, 8988.0, 20076.0, 20144.0]
|
[230.0, 23.0, 2206.0, 233.0]
|
[221, 271, 246, 272]
|
p02689
|
u316733945
| 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 _ in range(m)]\nprint(h)\nprint(ab)\n\na = []\nfor i in ab:\n if h[i[0]-1] > h[i[1]-1]:\n a.append(h[i[0]-1])\n else:\n a.append(h[i[1]-1])\nprint(len(set(a)))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [list(map(int, input().split())) for _ in range(m)]\n#print(h)\n#print(ab)\n\nl = [1 for _ in range(n)]\nfor i in ab:\n if h[i[0]-1] > h[i[1]-1]:\n l[i[1]-1] = 0\n elif h[i[1]-1] > h[i[0]-1]:\n l[i[0]-1] = 0\n else:\n l[i[1]-1] = 0\n l[i[0]-1] = 0\n\nprint(sum(l))']
|
['Wrong Answer', 'Accepted']
|
['s768943947', 's190510265']
|
[35176.0, 31920.0]
|
[349.0, 305.0]
|
[268, 339]
|
p02689
|
u325149030
| 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_val = [H[i] for i in range(N)]\nfor _ in range(M):\n A, B = map(int, input().split())\n A, B = A-1, B-1\n if H[A] > H[B]:\n H_val[B] = 0\n \n elif H[B] > H[A]:\n H_val[A] = 0\n \n else:\n H_val[A], H_val[B] = 0, 0\n\n print(H, H_val)\n\ncount = 0\nfor i in range(N):\n if H_val[i] != 0:\n count+= 1\n\nprint(count)\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nH_val = [H[i] for i in range(N)]\nfor _ in range(M):\n A, B = map(int, input().split())\n A, B = A-1, B-1\n if H[A] > H[B]:\n H_val[B] = 0\n \n elif H[B] > H[A]:\n H_val[A] = 0\n \n else:\n H_val[A], H_val[B] = 0, 0\n\ncount = 0\nfor i in range(N):\n if H_val[i] != 0:\n count+= 1\n\nprint(count)\n']
|
['Runtime Error', 'Accepted']
|
['s476621819', 's987536336']
|
[141748.0, 20064.0]
|
[1948.0, 260.0]
|
[429, 408]
|
p02689
|
u331330867
| 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()))\nlb=[True]*n\nfor r in range(m):\n a,b=input().split()\n a,b=int(a)-1,int(b)-1\n if H[a]>H[b]:\n lb[b]=False\n elif H[a]<H[b]:\n lb[a]=False\n else:\n lb[a]=False\n lb[b]=False\nlb.count(True)', 'n,m=map(int,input().split())\nH=list(map(int,input().split()))\nlb=[True]*n\nfor r in range(m):\n a,b=input().split()\n a,b=int(a)-1,int(b)-1\n if H[a]>H[b]:\n lb[b]=False\n elif H[a]<H[b]:\n lb[a]=False\n else:\n lb[a]=False\n lb[b]=False\nprint(lb.count(True))']
|
['Wrong Answer', 'Accepted']
|
['s578915153', 's780948254']
|
[20116.0, 19964.0]
|
[242.0, 253.0]
|
[285, 292]
|
p02689
|
u331997680
| 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 = [1]*(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] = 0\n if H[b-1] >= H[a-1]:\n H[a-1] = 0\nprint(sum(C))', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nC = [1]*(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] = 0\n if H[b-1] >= H[a-1]:\n C[a-1] = 0\nprint(sum(C))']
|
['Wrong Answer', 'Accepted']
|
['s160278270', 's338658338']
|
[20096.0, 20064.0]
|
[260.0, 253.0]
|
[224, 224]
|
p02689
|
u332926534
| 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\nAB = [list(map(int, input().split())) for _ in range(M)]\n\ncheck = [True] * N\n\nfor ab in AB:\n \n print(ab, "left: ", H[ab[0]-1], "right: ", H[ab[1]-1]) \n if H[ab[0]-1] < H[ab[1] - 1]:\n check[ab[0]-1] = False\n elif H[ab[0]-1] > H[ab[1] - 1]:\n check[ab[1]-1] = False\n #else:\n # check[ab[0]-1] = not check[ab[0]-1]\n print(check)\nprint(sum(check))\n', '\nN, M = map(int, input().split())\nH = list(map(int, input().split()))\n\nAB = [list(map(int, input().split())) for _ in range(M)]\n\ncheck = [True] * N\n\nfor ab in AB:\n \n if H[ab[0]-1] < H[ab[1] - 1]:\n check[ab[0]-1] = False\n \n elif H[ab[1]-1] < H[ab[0] - 1]:\n check[ab[1]-1] = False\n else:\n check[ab[0]-1] = False\n check[ab[1]-1] = False\n \nprint(sum(check))\n']
|
['Runtime Error', 'Accepted']
|
['s176187574', 's367825967']
|
[158672.0, 32012.0]
|
[2678.0, 294.0]
|
[462, 415]
|
p02689
|
u344888046
| 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_B = [""] * M\n\nfor c in range(M):\n A_B[c] = list(map(int, input().split()))\n\nhd = {}\n\nfor co in range(N):\n hd[co + 1] = H[co]\n\nprint(hd)\nprint("a")', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\n\nA_B = [[] for _ in range(N)]\nA_B.insert(0, 0)\nH.insert(0, 0)\n\nfor c in range(M):\n A, B = map(int, input().split())\n A_B[A].append(B)\n A_B[B].append(A)\n\nans = 0\n\nfor c in range(1, N + 1):\n for co in range(len(A_B[c])):\n if H[c] <= H[A_B[c][co]]:\n break\n else:\n ans += 1\n\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s631330898', 's672960464']
|
[42896.0, 29500.0]
|
[290.0, 370.0]
|
[224, 390]
|
p02689
|
u345621867
| 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 = [0] * m\nfor i in range(m):\n ab[i] = list(map(int, input().split()))\ncheck = [1] * n\n\nfor i in range(m):\n \n if h[ab[i][0]-1] = h[ab[i][1]-1]:\n check[ab[i][0]-1] = 0\n check[ab[i][1] - 1] = 0\n elif h[ab[i][0] - 1] < h[ab[i][1]-1]:\n check[ab[i][0] - 1] = 0\n else:\n check[ab[i][1]-1] = 0\nprint(sum(check))\n', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [0] * m\nfor i in range(m):\n ab[i] = list(map(int, input().split()))\nprint(h)\nprint(ab)\ncheck = [1] * n\n\nfor i in range(m):\n \n if h[ab[i][0]-1] < h[ab[i][1]-1]:\n check[ab[i][0]-1] = 0\n else:\n check[ab[i][1]-1] = 0\nprint(sum(check))\n\n', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [0] * m\nfor i in range(m):\n ab[i] = list(map(int, input().split()))\ncheck = [1] * n\n\nfor i in range(m):\n \n if h[ab[i][0]-1] == h[ab[i][1]-1]:\n check[ab[i][0]-1] = 0\n check[ab[i][1] - 1] = 0\n elif h[ab[i][0] - 1] < h[ab[i][1]-1]:\n check[ab[i][0] - 1] = 0\n else:\n check[ab[i][1]-1] = 0\nprint(sum(check))\n']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s133746837', 's846634668', 's416688992']
|
[9040.0, 35144.0, 32012.0]
|
[22.0, 379.0, 333.0]
|
[480, 394, 481]
|
p02689
|
u347134705
| 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 \nH = list(map(int,input().split()))\n \nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i] ,B[i] = map(int,input().split())\n \n\nS=[1]*N\n\n \nfor m in range(M)\n if H[A[m]-1] == H[B[m]-1]:\n S[A[m]-1] = 0\n S[B[m]-1] = 0\n elif H[A[m]-1] <= H[B[m]-1]:\n S[A[m]-1] = 0\n elif H[A[m]-1] >= H[B[m]-1]\n S[B[m]-1] = 0\n\n \nprint(sum(S)) ', 'N , M = map(int,input().split())\n\nH = list(map(int,input().split()))\n\nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i] ,B[i] = map(int,input().split())\n\n\ncount = 0\n\nfor i in range(1,N+1):\n flag = 0\n for m in range(M):\n if i == A[m] and H[i-1]<= H[B[m]-1]:\n flag = 1\n continue\n elif i == B[m] and H[i-1]<=H[A[m]-1]:\n flag = 1\n continue\n \n if not flag:\n print(i)\n count += 1\n\nprint(count) ', "N , M = map(int,input().split())\n\nH = list(map(int,input().split()))\n\nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i] ,B[i] = map(int,input().split())\n\n\ncount = 0\n\nfor i in range(1,N+1):\n flag = 0\n for m in range(M):\n if i == A[m] and H[i-1]<= H[B[m]-1]:\n print('a'+A[i]+','+B[i])\n print(H[i-1]+','+H[B[m]-1])\n flag = 1\n continue\n elif i == B[m] and H[i-1]<=H[A[m]-1]:\n print('b'+A[i]+','+B[i])\n print(H[i-1]+','+H[B[m]-1])\n flag = 1\n continue\n \n if not flag:\n print(i)\n count += 1\n\nprint(count) \n ", 'N , M = map(int,input().split())\n \nH = list(map(int,input().split()))\n \nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i] ,B[i] = map(int,input().split())\n \n \nS=[1]*N\n \n \nfor m in range(M):\n if H[A[m]-1] == H[B[m]-1]:\n S[A[m]-1] = 0\n S[B[m]-1] = 0\n elif H[A[m]-1] <= H[B[m]-1]:\n S[A[m]-1] = 0\n elif H[A[m]-1] >= H[B[m]-1]:\n S[B[m]-1] = 0\n \n \nprint(sum(S)) ']
|
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
|
['s200828530', 's438324119', 's448328014', 's454798001']
|
[8868.0, 21056.0, 20996.0, 21848.0]
|
[23.0, 2206.0, 285.0, 292.0]
|
[364, 424, 608, 369]
|
p02689
|
u350578302
| 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 = []\nB = []\ncmb = {}\ncnt = 0\nflag = 1\n\nfor i in range(1, M+1):\n\tcmb.setdefault(i, [])\n\n\nfor i in range(M):\n\ta,b = map(int,input().split())\n\n\tcmb.setdefault(a, []).append(b)\n\tcmb.setdefault(b, []).append(a)\n\nfor j in range(1,N+1):\n\tif len(cmb[j])==0:\n\t\tcnt += 1\n\telse:\n\t\tk = list(set(cmb[j]))\n\t\tflag = 1\n\t\tfor i in range(len(k)):\n\t\t\tprint(j)\n\t\t\tif H[j-1] <= H[k[i]]:\n\t\t\t\tflag = 0\n\t\t\t\tbreak;\n\n\t\tif flag == 1:\n\t\t\tcnt += 1\nprint(cnt-1)', 'N, M = map(int,input().split())\nH = list(map(int,input().split()))\n\nA = []\nB = []\ncmb = {}\ncnt = 0\nflag = 1\n\nfor i in range(1, M+1):\n\tcmb.setdefault(i, [])\n\n\nfor i in range(M):\n\ta,b = map(int,input().split())\n\n\tcmb.setdefault(a, []).append(b)\n\tcmb.setdefault(b, []).append(a)\n\nfor j in range(1,N+1):\n\tif len(cmb[j])==0:\n\t\tcnt += 1\n\telse:\n\t\tk = list(set(cmb[j]))\n\t\tflag = 1\n\t\tfor i in range(len(k)):\n\t\t\tif H[j-1] <= H[k[i]]:\n\t\t\t\tflag = 0\n\t\t\t\tbreak;\n\n\t\tif flag == 1:\n\t\t\tcnt += 1\nprint(cnt-1)', "N, M = map(int,input().split())\nH = list(map(int,input().split()))\n\nA = []\nB = []\ncmb = {}\ncnt = 0\nflag = 1\nma = [0]*N\n\nfor i in range(M):\n\ta,b = map(int,input().split())\n\n\tcmb.setdefault(i, [])\n\tcmb.setdefault(a-1, []).append(b-1)\n\tcmb.setdefault(b-1, []).append(a-1)\n\n\tma[a-1] = max(ma[a-1], H[b-1])\n\tma[b-1] = max(ma[b-1], H[a-1])\n# print(cmb)\n\nfor j in range(N):\n\t\n\t\n\t# # print(k)\n\t# if len(cmb[j])==0:\n\t\n\t# \tcnt +=1\n\t# else:\n\t# \t# print(H[j], '>', ma[j])\n\n\tif H[j] > ma[j]:\n\t\t# print('GOOD')\n\t\tcnt += 1\nprint(cnt)"]
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s093103468', 's565676358', 's941482243']
|
[39720.0, 39492.0, 38616.0]
|
[581.0, 538.0, 540.0]
|
[503, 491, 596]
|
p02689
|
u353519457
| 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()))\ng = [[] for _ in range(n+1)]\nfor i in range(m):\n a, b = map(int, input().split())\n g[a].append(b)\n g[b].append(a)\n\ncnt = 0\nfor i in range(1, n+1):\n if len(g[i]) == 0:\n continue\n for j in g[i]:\n print(i, j)\n print(h[j-1], h[i-1])\n if h[j-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()))\ng = [[] for _ in range(n+1)]\nfor i in range(m):\n a, b = map(int, input().split())\n g[a].append(b)\n g[b].append(a)\n\ncnt = 0\nfor i in range(1, n+1):\n for j in g[i]:\n if h[j-1] >= h[i-1]:\n break\n else:\n cnt += 1\n\nprint(cnt)']
|
['Wrong Answer', 'Accepted']
|
['s226451466', 's587315655']
|
[29444.0, 29336.0]
|
[572.0, 393.0]
|
[419, 329]
|
p02689
|
u354862173
| 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\nimport numpy as np\nfrom math import ceil as C, floor as F, sqrt\nfrom collections import defaultdict as D, Counter as CNT\nfrom functools import reduce as R\n \nALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nalp = 'abcdefghijklmnopqrstuvwxyz'\ndef _X(): return sys.stdin.readline().rstrip().split(' ')\ndef _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]\ndef S(): return _S(_X())\ndef Ss(): return list(S())\ndef _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)\ndef I(): return _I(S())\ndef _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]\ndef Is(): return _Is(I())\n\n_, e = I()\nhs = Is()\n\nobs = sorted([(i, h) for i, h in enumerate(hs, 1)], key=lambda x:x[1], reverse=True)\nseen = D(bool)\n\nroads = D(set)\nfor _ in range(e):\n a, b = I()\n roads[a].add(b)\n roads[b].add(a)\n \nans = 0\nfor ob in obs:\n if not seen[ob[0]]:\n if all(ob[1] > hs[r] for r in roads[ob[0]]):\n ans += 1\n seen[ob[0]] = True\n for r in roads[ob[0]]:\n seen[r] = True\n \nprint(ans)", "import sys\nimport numpy as np\nfrom math import ceil as C, floor as F, sqrt\nfrom collections import defaultdict as D, Counter as CNT\nfrom functools import reduce as R\n \nALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nalp = 'abcdefghijklmnopqrstuvwxyz'\ndef _X(): return sys.stdin.readline().rstrip().split(' ')\ndef _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]\ndef S(): return _S(_X())\ndef Ss(): return list(S())\ndef _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)\ndef I(): return _I(S())\ndef _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]\ndef Is(): return _Is(I())\n\n_, e = I()\nhs = Is()\n\nobs = sorted([(i, h) for i, h in enumerate(hs, 1)], key=lambda x:x[1], reverse=True)\nseen = D(bool)\n\nroads = D(set)\nfor _ in range(e):\n a, b = I()\n roads[a].add(b)\n roads[b].add(a)\n \nans = 0\nfor ob in obs:\n if not seen[ob[0]]:\n if all(ob[1] > hs[r-1] for r in roads[ob[0]]):\n ans += 1\n seen[ob[0]] = True\n for r in roads[ob[0]]:\n seen[r] = True\n \nprint(ans)"]
|
['Runtime Error', 'Accepted']
|
['s708096324', 's510633003']
|
[88412.0, 87628.0]
|
[705.0, 693.0]
|
[1009, 1011]
|
p02689
|
u357751375
| 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 = [list(map(int,input().split())) for i in range(m)]\na,b = [list(i) for i in zip(*l)]\nz = [1] * n\n\nfor i in range(m):\n x = a[i] - 1\n y = b[i] - 1\n if h[x] < h[y]:\n z[x] = 0\n else:\n z[y] = 0\n\nprint(z)\nprint(n - z.count(0))', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\nl = [list(map(int,input().split())) for i in range(m)]\na,b = [list(i) for i in zip(*l)]\nz = [1] * n\n\nfor i in range(m):\n x = a[i] - 1\n y = b[i] - 1\n if h[x] < h[y]:\n z[x] = 0\n elif h[x] > h[y]:\n z[y] = 0\n else:\n z[x] = 0\n z[y] = 0\n\nprint(n - z.count(0))']
|
['Wrong Answer', 'Accepted']
|
['s851822400', 's245710648']
|
[39828.0, 39740.0]
|
[314.0, 305.0]
|
[315, 362]
|
p02689
|
u361631791
| 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?
|
["from collections import defaultdict\n\nvisited = [False for _ in range(100001)]\n\n\ndef dfs(p: int, n: int, h: list, ways: dict, result: dict):\n if visited[p]:\n return\n \n visited[p] = True\n result[h[p-1]] += 1\n\n for w in ways[p]:\n dfs(w, n, h, ways, result)\n\n\ndef main():\n tmp = [int(i) for i in input().split()]\n n = tmp[0]\n m = tmp[1]\n\n ways = defaultdict(set)\n h = [int(i) for i in input().split()]\n for _ in range(m):\n tmp = [int(i) for i in input().split()]\n ways[tmp[0]].add(tmp[1])\n ways[tmp[1]].add(tmp[0])\n \n cnt = 0\n for i in range(1, n+1):\n result = defaultdict(int)\n dfs(i, n, h, ways, result)\n if len(result) > 0:\n h_max = max(list(result.keys()))\n cnt += result[h_max]\n print(cnt)\n\nif __name__ == '__main__':\n main()\n", "from collections import defaultdict\n\ndef check(p: int, h: list, ways: dict):\n for w in ways[p]:\n if h[p] <= h[w]:\n return False\n return True\n\n\ndef main():\n tmp = [int(i) for i in input().split()]\n n = tmp[0]\n m = tmp[1]\n\n ways = defaultdict(set)\n h = [0] + [int(i) for i in input().split()]\n for _ in range(m):\n tmp = [int(i) for i in input().split()]\n ways[tmp[0]].add(tmp[1])\n ways[tmp[1]].add(tmp[0])\n \n cnt = 0\n for i in range(1, n+1):\n if check(i, h, ways):\n cnt += 1\n print(cnt)\n\nif __name__ == '__main__':\n main()\n"]
|
['Runtime Error', 'Accepted']
|
['s476023009', 's776357171']
|
[51368.0, 51944.0]
|
[462.0, 462.0]
|
[853, 617]
|
p02689
|
u362255558
| 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().strip().split(' ') ]\nH = [ int(i) for i in input().strip().split(' ') ]\npaths = []\nfor _m in range(M):\n path = input().strip().split(' ')\n path = int(path[0]), int(path[1])\n path = path if path[0] < path[1] else (path[1], path[0])\n if path not in paths:\n paths.append(path)\nprint(paths)\nall_paths = []\nfor path in paths:\n all_paths += path\nall_paths = set(all_paths)\ncount = 0\nfor n in range(1, N+1):\n is_good = 1\n if n not in all_paths:\n count += is_good\n continue\n for path in paths:\n if n not in list(path):\n continue\n if (path[0] == n):\n if (H[n-1] <= H[path[1]-1]):\n is_good = 0\n break\n else:\n if (H[n-1] <= H[path[0]-1]):\n is_good = 0\n break \n count += is_good\nprint(count)", "N, M = [ int(i) for i in input().strip().split(' ') ]\nH = [ int(i) for i in input().strip().split(' ') ]\npaths = []\nmax_neighbor = [ 0 for _ in range(N)]\n\nfor _m in range(M):\n path = input().strip().split(' ')\n path = int(path[0]), int(path[1])\n max_neighbor[path[0]-1] = max(max_neighbor[path[0]-1], H[path[1]-1])\n max_neighbor[path[1]-1] = max(max_neighbor[path[1]-1], H[path[0]-1])\ncount = 0\nfor n in range(N):\n if max_neighbor[n] < H[n]:\n count += 1\nprint(count)"]
|
['Wrong Answer', 'Accepted']
|
['s050199325', 's813856032']
|
[20076.0, 20144.0]
|
[2206.0, 334.0]
|
[880, 491]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.