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 | u362599643 | 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()]\nG = [0]*N\nL = [1]*N\n\nfor i in range(M):\n A, B = map(int, input().split())\n L[A-1] = 0\n L[B-1] = 0\n\n if H[A-1]>H[B-1]: \n G[A-1] = 1\n G[B-1] = 0\n elif H[A-1]<H[B-1]: \n G[B-1] = 1\n G[A-1] = 0\n elif H[A-1]==H[B-1]:\n G[B-1] = 0\n G[A-1] = 0\n\nprint(L)\nprint(G)\nprint(G.count(1)+L.count(1))\n', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\nans=[1]*n\nfor i in range(m):\n a,b=map(int,input().split())\n a-=1\n b-=1\n if h[a]>h[b]:ans[b]=0\n elif h[a]<h[b]:ans[a]=0\n elif h[a]==h[b]:ans[a]=ans[b]=0\nprint(ans.count(1))'] | ['Wrong Answer', 'Accepted'] | ['s658204107', 's438472558'] | [20044.0, 20052.0] | [278.0, 238.0] | [414, 239] |
p02689 | u364774090 | 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 = [int(x) for x in input().split()]\n\nhigh = set()\nlow = set()\nlonely = set()\n\nfor i in range(M):\n i1, i2 = [int(x) for x in input().split()]\n if H[i1 - 1] != H[i2 - 1]:\n high.add(i2)\n low.add(i1)\n lonely.add(i1)\n lonely.add(i2)\n\nresult = len((high - low)) + (N - len(lonely))', 'N, M = (int(x) for x in input().split())\nH = [int(x) for x in input().split()]\n\nhigh = set()\nlow = set()\nlonely = set()\n\nfor i in range(M):\n\ti1, i2 = [int(x) for x in input().split()]\n\tif H[i1 - 1] > H[i2 - 1]:\n\t\thigh.add(i1)\n\t\tlow.add(i2)\n\telif H[i1 - 1] < H[i2 - 1]:\n\t\thigh.add(i2)\n\t\tlow.add(i1)\n\telse:\n\t\tlow.add(i1)\n\t\tlow.add(i2)\n\tlonely.add(i1)\n\tlonely.add(i2)\n\nresult = len((high - low)) + (N - len(lonely))\nprint(result)'] | ['Wrong Answer', 'Accepted'] | ['s322782570', 's119199555'] | [28072.0, 27456.0] | [333.0, 328.0] | [341, 427] |
p02689 | u366424761 | 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())\ntree = list(map(int,input().split())) \ntree_sub = tree \nfor i in range(M):\n a,b = map(int,input().split())\n if (tree[a-1] > tree[b-1]) and (int(tree[b-1]) in tree_sub):\n tree_sub[b-1] = 0\n elif (tree[a-1] < tree[b-1]) and (tree[a-1] in tree_sub):\n tree_sub[a-1] = 0\ncount = 0\nfor i in range(M):\n if tree_sub[i] != 0:\n count += 1\nprint(count)', 'N,M = map(int,input().split())\ntree = list(map(int,input().split())) \ntree_sub = tree \nprint(len(tree_sub),N)\nfor i in range(M):\n a,b = map(int,input().split())\n if (tree[a-1] > tree[b-1]):\n tree_sub[b-1] = 0\n elif (tree[a-1] < tree[b-1]):\n tree_sub[a-1] = 0\n else:\n tree_sub[a-1] = 0\n tree_sub[b-1] = 0\nprint(len(tree_sub)-tree_sub.count(0))', 'N,M = map(int,input().split())\ntree = list(map(int,input().split())) \ntree_sub = tree \nfor i in range(M):\n a,b = map(int,input().split())\n if (tree[a-1] > tree[b-1]) and (tree[b-1] in tree_sub):\n tree_sub.remove(b)\n elif (tree[a-1] < tree[b-1]) and (tree[b-1] in tree_sub):\n tree_sub.remove(a)\nprint(len(tree_sub))', 'N,M = map(int,input().split())\ntree = list(map(int,input().split())) \ntree_sub = tree \ncount = 0\nfor i in range(M):\n a,b = map(int,input().split())\n if (tree[a-1] > tree[b-1]) and (tree[b-1]== tree_sub[b-1]):\n tree_sub[b-1] = 0\n elif (tree[a-1] < tree[b-1]) and (tree[a-1] == tree_sub[a-1]):\n tree_sub[a-1] = 0\nfor i in range(M):\n if tree_sub[i] !=0:\n count += 1\nprint(count)', 'N,M = map(int,input().split())\ntree = list(map(int,input().split())) \ntree_sub = list(tree) \nfor i in range(M):\n a,b = map(int,input().split())\n if tree[a-1] > tree[b-1]:\n tree_sub[b-1] = 0\n elif tree[a-1] < tree[b-1]:\n tree_sub[a-1] = 0\n else:\n tree_sub[a-1] = 0\n tree_sub[b-1] = 0\nprint(len(tree_sub)-tree_sub.count(0))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s132222888', 's144401841', 's529179849', 's956846959', 's206714772'] | [20084.0, 20112.0, 20072.0, 19940.0, 20060.0] | [2206.0, 249.0, 45.0, 269.0, 246.0] | [437, 414, 369, 440, 393] |
p02689 | u372102441 | 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\n#n = int(input())\n#l = list(map(int, input().split()))\n\n\n\nimport copy\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nok = [True for i in range(n)]\nmaxu=copy.copy(h)\nfor i in range(m):\n p = list(map(int, input().split()))\n if maxu[p[0]-1]<maxu[p[1]-1]:\n ok[p[0]-1]=False\n maxu[p[0]-1] = h[p[1]-1]\n elif maxu[p[0]-1] > maxu[p[1]-1]:\n ok[p[1]-1] = False\n maxu[p[1]-1] = h[p[0]-1]\n elif maxu[p[0]-1] == maxu[p[1]-1]:\n ok[p[1]-1]=False\n ok[p[0]-1]=False\ncnt=0\nfor i in range(len(ok)):\n if ok[i]==True:\n cnt+=1\nprint(maxu)\nprint(cnt)\n\n', 'import sys\ninput = sys.stdin.readline\n\n#n = int(input())\n#l = list(map(int, input().split()))\n\n\n\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nok = [True for i in range(n)]\n\nfor i in range(m):\n p = list(map(int, input().split()))\n if h[p[0]-1]<h[p[1]-1]:\n ok[p[0]-1]=False\n elif h[p[0]-1] > h[p[1]-1]:\n ok[p[1]-1] = False\n elif h[p[0]-1] == h[p[1]-1]:\n ok[p[1]-1] = False\n ok[p[0]-1] = False\ncnt=0\nfor i in range(len(ok)):\n if ok[i]==True:\n cnt+=1\n#print(ok)\nprint(cnt)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s160291950', 's956005555'] | [21208.0, 20340.0] | [209.0, 198.0] | [757, 647] |
p02689 | u373047809 | 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? | ['#!/usr/bin/env python3\na = 1\nx = int(input())\nwhile True:\n bz = (x-a**5)**.2\n if float.is_integer(bz):\n print(a, -int(bz))\n exit()\n a += 1', 'a = 0\nx = int(input())\nfor a in range(x):\n b = (x - a**5)**.2\n if type(b) in (int,float) and float.is_integer(float(b)):\n print(a, -int(b))\n exit()', '#!/usr/bin/env python3\nn, m = map(int, input().split())\n*h, = map(int, input().split())\nh = [0] + h\ni = [0] + [1] * n\n\nfor j in range(m):\n a, b = map(int, input().split())\n if h[a] >= h[b]:\n i[b] = 0\n if h[a] <= h[b]:\n i[a] = 0\nprint(sum(i))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s598941600', 's729950958', 's793302144'] | [9180.0, 9192.0, 20032.0] | [22.0, 25.0, 265.0] | [161, 167, 264] |
p02689 | u373295322 | 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()))\nroad_dict = {a+1: set() for a in range(n)}\nfor i in range(m):\n a, b = map(int, input().split())\n if a in road_dict:\n road_dict[a].add(b)\n else:\n road_dict[a] = set([b])\n if b in road_dict:\n road_dict[b].add(a)\n else:\n road_dict[b] = set([a])\nuse_list = []\nfor k, s in road_dict.items():\n s.add(k)\n tmp_use_list = []\n append_flg = True\n for s2 in use_list:\n if s2.isdisjoint(s):\n tmp_use_list.append(s2)\n else:\n tmp_use_list.append(s | s2)\n append_flg = False\n if append_flg:\n tmp_use_list.append(s)\n use_list = tmp_use_list.copy()\nres = 0\nfor s in use_list:\n m = 0\n use_s = list(s)\n d_flg = False\n for v in use_s:\n height = h_list[v-1]\n if height > m:\n m = height\n d_flg = False\n elif height == m:\n d_flg = True\n else:\n continue\n if ~d_flg:\n res += 1\nprint(res)\n \n \n ', 'n, m = map(int, input().split())\nh_list = list(map(int, input().split()))\nroad_dict = {a+1: set() for a in range(n)}\nfor i in range(m):\n a, b = map(int, input().split())\n if a in road_dict:\n road_dict[a].add(b)\n else:\n road_dict[a] = set([b])\n if b in road_dict:\n road_dict[b].add(a)\n else:\n road_dict[b] = set([a])\nuse_list = []\nres = 0\nfor k, s in road_dict.items():\n k_height = h_list[k-1]\n if len(s) == 0:\n res += 1\n else:\n add_flg = True\n for v in list(s):\n v_height = h_list[v-1]\n if k_height > v_height:\n continue\n else:\n add_flg = False\n break\n if add_flg:\n res += 1\nprint(res)\n'] | ['Wrong Answer', 'Accepted'] | ['s950090746', 's569396872'] | [55004.0, 54000.0] | [2207.0, 529.0] | [935, 659] |
p02689 | u375616706 | 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\ndef ok(B):\n i=1\n B=abs(B)\n while i**5<B:\n i+=1\n return i**5==B\n\ndef get(B):\n f = B/abs(B)\n i=1\n B=abs(B)\n while i**5<B:\n i+=1\n return int(i*f)\n\n\n\nA_cand=[]\ni=0\nwhile i**5<=10**10:\n A_cand.append(i)\n i+=1\n\n#print(A_cand)\nfor a in range(300):\n B_5=a**5-X\n if ok(B_5):\n r=get(B_5)\n print(a,r)\n exit()\n break\n', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\nadj=[set() for _ in range(N)]\nfor _ in range(M):\n a,b = map(lambda x:int(x)-1,input().split())\n adj[a].add(b)\n adj[b].add(a)\n\n\nans=0\nfor i in range(N):\n if len(adj[i])==0:\n ans+=1\n elif all([H[i]>H[v] for v in adj[i]]):\n ans+=1\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s219421589', 's171215215'] | [9124.0, 45312.0] | [24.0, 506.0] | [402, 334] |
p02689 | u382169668 | 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_tree = map(int, input().split())\nGOOD_Tree = [1 for n in range(len(H_tree))]\n\nfor n i in range(M):\n A, B =map(int, input().split())\n if H_tree[A-1]>=H_tree[B-1]:\n GOOD_tree[A-1] = 0\n else:\n GOOD_tree[B-1] = 0\nprint(GOOD_tree.count(1))', 'N, M =map(int, input().split())\nH_tree =[0]+[int(n) for n in input().split()]\nGOOD_Tree = [0]+[1 for n in range(N)]\n \nfor i in range(M):\n A, B = map(int, input().split())\n if H_tree[A]<=H_tree[B]:GOOD_Tree[A] = 0\n if H_tree[A]>=H_tree[B]:GOOD_Tree[B] = 0\nprint(sum(GOOD_Tree))'] | ['Runtime Error', 'Accepted'] | ['s179369405', 's763489041'] | [9024.0, 19976.0] | [25.0, 245.0] | [277, 279] |
p02689 | u383450070 | 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()))\nlst = [0] * n\nfor j in range(m):\n a,b=map(int,input().split())\n if height[a-1]<height[b-1]:\n if lst[a-1] == -1:\n lst[b-1]+=1\n else:\n lst[a-1]=-1\n lst[b-1]+=1\n elif height[a-1]>height[b-1]:\n if lst[b-1] == -1:\n lst[a-1]+=1\n else:\n lst[a-1]+=1\n lst[b-1]=-1\n elif height[a-1]==height[b-1]:\n lst[a-1] = -1\n lst[b-1] = -1\ncnt = 0\nprint(lst)\nfor k in range(n):\n if lst[k]>=0:\n cnt+=1\nprint(cnt)', 'n,m=map(int,input().split())\nheight = list(map(int,input().split()))\nlst = [0] * n\nfor j in range(m):\n a,b=map(int,input().split())\n if height[a-1]<height[b-1]:\n lst[a-1]=-1\n lst[b-1]+=1\n elif height[a-1]>height[b-1]:\n lst[a-1]+=1\n lst[b-1]=-1\n elif height[a-1]==height[b-1]:\n lst[a-1] = -1\n lst[b-1] = -1\ncnt = 0\nprint(lst)\nfor k in range(n):\n if lst[k]>=0:\n cnt+=1\nprint(cnt)', 'n,m=map(int,input().split())\nheight = list(map(int,input().split()))\nlst = [0] * n\nfor j in range(m):\n a,b=map(int,input().split())\n if height[a-1]<height[b-1]:\n if lst[b-1] == -1:\n lst[a-1]=-1\n else:\n lst[a-1]=-1\n lst[b-1]+=1\n elif height[a-1]>height[b-1]:\n if lst[a-1]==-1:\n lst[b-1]=-1\n else:\n lst[a-1]+=1\n lst[b-1]=-1\n elif height[a-1]==height[b-1]:\n lst[a-1] = -1\n lst[b-1] = -1\ncnt = 0\nfor k in range(n):\n if lst[k]>=0:\n cnt+=1\nprint(cnt)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s463019662', 's811771916', 's906549674'] | [20068.0, 20132.0, 20160.0] | [282.0, 301.0, 302.0] | [513, 403, 500] |
p02689 | u384476576 | 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 = list(map(int, input().split()))\nroad_list = []\n\nfor _ in range(M):\n road_list.append([])\nfor i in range(M):\n a, b = list(map(int, input().split()))\n H_a, H_b = [H_list[a - 1], H_list[b - 1]]\n if H_a <= H_b:\n road_list[a - 1].append(a)\n elif H_b <= H_a:\n road_list[b - 1].append(b)\n\nans = 0\nfor road in road_list:\n if len(road) == 0:\n ans += 1\nprint(ans)', 'N, M = list(map(int, input().split()))\nH_list = list(map(int, input().split()))\n\nroad_list = []\nfor _ in range(N):\n road_list.append([])\n \nfor i in range(M):\n a, b = list(map(int, input().split()))\n \n H_a, H_b = [H_list[a - 1], H_list[b - 1]]\n \n if H_a <= H_b:\n road_list[a - 1].append(b)\n\n if H_b <= H_a:\n road_list[b - 1].append(a)\n\nans = 0\nfor road in road_list:\n if len(road) == 0:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s003703155', 's227384639'] | [25080.0, 25156.0] | [377.0, 362.0] | [440, 454] |
p02689 | u387080888 | 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,ans=[],[]\nfor _ in range(M):\n a.append(list(map(int,input().split())))\nfor i in range(M):\n if H[(a[i][0])-1]>H[(a[i][1])-1]:\n ans.append(a[i][0])\n elif H[(a[i][0])-1]<H[(a[i][1])-1]:\n ans.append(a[i][1])\nprint(len(ans))', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\na,ans=[],set()\nfor _ in range(M):\n a.append(list(map(int,input().split())))\nfor i in range(M):\n if H[(a[i][0])-1]>H[(a[i][1])-1]:\n ans.add(a[i][0])\n if len(ans)!=0:\n for k in range(len(ans)):\n if list(ans)[k]==a[i][1]:\n ans.remove(list(ans)[k])\n break\n elif H[(a[i][0])-1]<H[(a[i][1])-1]:\n ans.add(a[i][1])\n if len(ans)!=0: \n for j in range(len(ans)):\n if list(ans)[j]==a[i][0]:\n ans.remove(list(ans)[j])\n break\nn=set()\nfor k in range(M):\n for l in range(2):\n n.add(a[k][l])\nprint(len(ans)+M-len(n))', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\na,ans=[],[]\nfor _ in range(M):\n a.append(list(map(int,input().split())))\nfor i in range(M):\n if H[(a[i][0])-1]>H[(a[i][1])-1]:\n ans.add(a[i][0])\n elif H[(a[i][0])-1]<H[(a[i][1])-1]:\n ans.append(a[i][1])\nprint(len(ans))', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\nt=[1]*N\nfor i in range(M):\n a,b=map(int,input().split())\n if H[a-1]>H[b-1]:\n t[b-1]=0\n elif H[a-1]<H[b-1]:\n t[a-1]=0\n else:\n t[a-1],t[b-1]=0,0\nprint(sum(t))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s108212530', 's538592163', 's935339470', 's228684928'] | [32016.0, 31336.0, 31220.0, 19972.0] | [333.0, 2207.0, 248.0, 255.0] | [306, 739, 303, 251] |
p02689 | u391675400 | 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\ncheck = [True] * n \nfor i in range(m):\n print(i)\n a,b = (map(int,input().split()))\n if h[a-1] > h[b-1]:\n check[b-1] = False\n elif h[a-1] < h[b-1]:\n # print("i,check",i,check)\n check[a-1] = False\n else:\n check[a-1] = False\n check[b-1] = False\nprint(sum(check))\n\n\n', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\n\ncheck = [True] * n \nfor i in range(m):\n #print(i)\n a,b = (map(int,input().split()))\n if h[a-1] > h[b-1]:\n check[b-1] = False\n elif h[a-1] < h[b-1]:\n # print("i,check",i,check)\n check[a-1] = False\n else:\n check[a-1] = False\n check[b-1] = False\nprint(sum(check))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s837582219', 's068051458'] | [19948.0, 20112.0] | [483.0, 250.0] | [405, 405] |
p02689 | u397020326 | 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()))\nroad = [list(map(int, input().split())) for i in range(M)]\nDP = [0 for i in range(N+1)]\nDP[0] = -1\nkouho = []\n\nfor i in range(M):\n Ai = road[i][0]\n Bi = road[i][1]\n if H[Ai - 1] > H[Bi - 1]:\n if DP[Ai] != -1:\n DP[Ai] = 1\n DP[Bi] = -1\n elif H[Ai - 1] == H[Bi - 1]:\n if DP[Ai] != -1 and DP[Bi] != -1:\n DP[Ai] = 1\n DP[Bi] = 1\n else:\n DP[Ai] = -1\n DP[Bi] = -1\n else:\n if DP[Bi] != -1:\n DP[Bi] = 1\n DP[Ai] = -1 \n\nans = 0\nfor i in DP:\n if i != -1:\n ans += 1\n\nprint(ans)\nprint(DP)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nroad = [list(map(int, input().split())) for i in range(M)]\nDP = [0 for i in range(N+1)]\nDP[0] = -1\nkouho = []\n\nfor i in range(M):\n Ai = road[i][0]\n Bi = road[i][1]\n if H[Ai - 1] > H[Bi - 1]:\n if DP[Ai] != -1:\n DP[Ai] = 1\n DP[Bi] = -1\n elif H[Ai - 1] == H[Bi - 1]:\n DP[Ai] = -1\n DP[Bi] = -1\n else:\n if DP[Bi] != -1:\n DP[Bi] = 1\n DP[Ai] = -1 \n\nans = 0\nfor i in DP:\n if i != -1:\n ans += 1\n\nprint(ans)\n#print(DP)'] | ['Wrong Answer', 'Accepted'] | ['s292613463', 's883303589'] | [32828.0, 31740.0] | [372.0, 349.0] | [599, 514] |
p02689 | u400221789 | 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\nfor i in range(m):\n a,b, = map(int,input().split())\n if h[a-1] >= h[b-1]:\n ans[b-1] =0\n if h[a-1] <= h[b-1]:\n ans[a-1] = 0\n print(ans)\nprint(sum(ans))', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\nans = [1] * n\nfor i in range(m):\n a,b, = map(int,input().split())\n if h[a-1] >= h[b-1]:\n ans[b-1] =0\n if h[a-1] <= h[b-1]:\n ans[a-1] = 0\nprint(sum(ans))'] | ['Wrong Answer', 'Accepted'] | ['s434361119', 's172634679'] | [122520.0, 20068.0] | [3611.0, 258.0] | [240, 227] |
p02689 | u400692785 | 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()))\nli = []\nfor m in range(M):\n a, b = map(int, input().split())\n if h[a-1] < h[b-1]:\n li.append(a)\n if h[a-1] == h[b-1]:\n li.append(a)\n li.append(b)\n else:\n li.append(b)\n\nanswer = N - len(set(li))\nprint(answer)', 'N, M = map(int, input().split())\nh = list(map(int, input().split()))\nli = []\nfor m in range(M):\n a, b = map(int, input().split())\n if h[a-1] < h[b-1]:\n li.append(a)\n elif h[a-1] == h[b-1]:\n li.append(a)\n li.append(b)\n else:\n li.append(b)\n\nanswer = N - len(set(li))\nprint(answer)'] | ['Wrong Answer', 'Accepted'] | ['s542550710', 's105010960'] | [23184.0, 19984.0] | [282.0, 251.0] | [292, 294] |
p02689 | u411478442 | 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())\nobs_height = [int(x) for x in input().split()]\ngood_obs_num = 0\ncheck_list = []\n\nfor i in range(M):\n a,b = (int(x) for x in input().split())\n if(a < b):\n good_obs_num += 1\n \nprint(good_obs_num)', 'def is_good_obs(num,obs_height,linked_num):\n for e in linked_num[num-1]: \n if(obs_height[i-1] <= obs_height[e]):\n return False\n return True\n \n\nN,M = (int(x) for x in input().split())\nobs_height = [int(x) for x in input().split()]\nlinked_num = [[] for i in range(N)]\ngood_obs_num = 0\n\nfor i in range(M):\n a,b = (int(x) for x in input().split())\n linked_num[a-1].append(b-1)\n linked_num[b-1].append(a-1)\n \nfor i in range(N):\n if(is_good_obs(i,obs_height,linked_num)):\n good_obs_num += 1\n \nprint(good_obs_num)'] | ['Wrong Answer', 'Accepted'] | ['s160184810', 's897862896'] | [20064.0, 29416.0] | [228.0, 433.0] | [243, 534] |
p02689 | u411858517 | 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()))\nroot = [list(map(int, input().split())) for _ in range(M)]\n\nis_min = [0 for _ in range(N)]\nfor i in range(M):\n A = root[i][0] - 1\n B = root[i][1] - 1\n\n if H[A] > H[B]]:\n is_min[B] = 1\n\n elif H[A] == H[B]]:\n is_min[A] = 1\n is_min[B] = 1\n\n else:\n is_min[A] = 1\n\nprint(N - sum(is_min))\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nroot = [list(map(int, input().split())) for _ in range(M)]\n\nis_min = [0 for _ in range(N)]\nfor i in range(M):\n A = root[i][0] - 1\n B = root[i][1] - 1\n\n if H[A] > H[B]:\n is_min[B] = 1\n\n elif H[A] == H[B]:\n is_min[A] = 1\n is_min[B] = 1\n\n else:\n is_min[A] = 1\n\nprint(N - sum(is_min))'] | ['Runtime Error', 'Accepted'] | ['s513720444', 's416016788'] | [9000.0, 31880.0] | [25.0, 314.0] | [395, 392] |
p02689 | u413318755 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['def main():\n N, M = map(int, input().split())\n HN = list(map(int, input().split()))\n\n temp = [True for _ in range(N)]\n for _ in range(M):\n A, B = map(int, input().split())\n\n if HN[A - 1] < HN[B - 1]:\n temp[A - 1] = False\n if HN[B - 1] < HN[A - 1]:\n temp[B - 1] = False\n else:\n temp[A - 1] = False\n temp[B - 1] = False\n\n print(sum([1 for a in temp if a]))\n\n\nmain()\n', 'def main():\n N, M = map(int, input().split())\n HN = list(map(int, input().split()))\n\n temp = [True for _ in range(N)]\n for _ in range(M):\n A, B = map(int, input().split())\n\n if HN[A - 1] < HN[B - 1]:\n temp[A - 1] = False\n elif HN[B - 1] < HN[A - 1]:\n temp[B - 1] = False\n else:\n temp[A - 1] = False\n temp[B - 1] = False\n\n print(sum([1 for a in temp if a]))\n\n\nmain()\n'] | ['Wrong Answer', 'Accepted'] | ['s945314881', 's114054438'] | [20036.0, 20120.0] | [247.0, 237.0] | [451, 453] |
p02689 | u416779002 | 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()))\nalllist = []\nnotwinner = []\nfor i in range(M):\n ab = list(map(int,input().split()))\n if H[ab[0]-1] > H[ab[1]-1]:\n notwinner.append(ab[1])\n elif H[ab[0]-1] < H[ab[1]-1]:\n notwinner.append(ab[0])\n else:\n notwinner.append(ab[0])\n notwinner.append(ab[1])\nwtou = N - len(notwinner)\nprint(wtou)\n', 'N,M = map(int,input().split())\nH = list(map(int,input().split()))\nnotwinner = []\nfor i in range(M):\n ab = list(map(int,input().split()))\n if H[ab[0]-1] > H[ab[1]-1]:\n notwinner.append(ab[1])\n elif H[ab[0]-1] < H[ab[1]-1]:\n notwinner.append(ab[0])\n else:\n notwinner.append(ab[0])\n notwinner.append(ab[1])\nwtou = N - len(set(notwinner))\nprint(wtou)\n'] | ['Wrong Answer', 'Accepted'] | ['s961728593', 's199221593'] | [20124.0, 20120.0] | [264.0, 268.0] | [395, 459] |
p02689 | u418199806 | 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 = []\nfor i in range(M):\n A, B = map(int, input().split())\n ans = [max(H[A-1], H[B-1]) if i == H[A-1] else i for i in ans]\n ans = [max(H[A-1], H[B-1]) if i == H[B-1] else i for i in ans]\n ans.append(max(H[A-1], H[B-1])) \nprint(set(ans))\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\n\nsm = []\nfor i in range(M):\n A, B = map(int, input().split())\n if H[A-1] <= H[B-1] :\n sm.append(A)\n if H[B-1] <= H[A-1] :\n sm.append(B)\nprint(N - len(set(sm)))'] | ['Wrong Answer', 'Accepted'] | ['s214820597', 's830570999'] | [20148.0, 20032.0] | [2206.0, 253.0] | [348, 247] |
p02689 | u433380437 | 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\nn,m = map(int,input().split())\nh=list(map(int,input().split()))\ng = [[] for _ in range(n)]\nfor _ in range(m):\n a,b = map(int,input().split())\n a-=1\n b-=1\n g[a].append(b)\n g[b].append(a)\nans=0\nfor j in range(n):\n for i in g[j]:\n if h[j]<=h[i]:\n break\n else:\n print(j)\n ans+=1\nprint(ans)', 'from collections import deque\nn,m = map(int,input().split())\nh=list(map(int,input().split()))\ng = [[] for _ in range(n)]\nfor _ in range(m):\n a,b = map(int,input().split())\n a-=1\n b-=1\n g[a].append(b)\n g[b].append(a)\nans=0\nfor j in range(n):\n for i in g[j]:\n if h[j]<=h[i]:\n break\n else:\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s085687893', 's010639416'] | [29864.0, 29648.0] | [379.0, 365.0] | [368, 351] |
p02689 | u434296044 | 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()))\nt=[0]*N\nfor i in range(M):\n A,B=map(int,input().split())\n t[A-1] = max(t[A-1], H[B-1])\n t[B-1] = max(t[B-1], H[A-1])\n\nct=0\nfor j in range(N):\n if H[j]>[j]:\n ct+=1\nprint(ct)\n', 'N,M=map(int,input().split())\nh=list(map(int,input().split()))\nt=[0]*N\nfor i in range(M):\n A,B=map(int,input().split())\n t[A-1] = max(t[A-1], h[B-1])\n t[B-1] = max(t[B-1], h[A-1])\n\nct=0\nfor j in range(N):\n if h[j]>t[j]:\n ct+=1\nprint(ct)\n'] | ['Runtime Error', 'Accepted'] | ['s687230786', 's423196370'] | [20136.0, 20152.0] | [45.0, 317.0] | [255, 255] |
p02689 | u436660228 | 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? | ['total_tenb,total_load=map(int,input().split())\nhight=[]\ngood_tenb=[]\nfor i in range(total_tenb):\n a=int(input())\n hight.append(a)\n good_tenb.append(a)\n \ndef kuraberu(A,B):\n if hight[A]>hight[B]:\n good_tenb.append(height[A])\n good_tenb.del(height[B])\n elif hight[A]<hight[B]:\n good_tenb.append(hight[B])\n good_tenb.del(hight[A])\n \n \nfor h in range(total_load):\n A[h]=int(input())\n B[h]=int(input())\n kuraberu(A[h],B[h])\n \n \nprint(len(set(good_tenb))) \n \n \n ', 'N,M=map(int,input().split())\nH=list(map(int,input().split))\ncheck=[0]*N\nfor i in range(M):\n A,B=map(int,input.split)\n if H[A-1]>H[B-1]:\n check[A-1]=check[A-1]+1\n check[B-1]=check[B-1]-1\n elif H[A-1]<H[B-1]:\n check[A-1]=check[A-1]-1\n check[B-1]=check[B-1]+1\n \n \nans=check.count()\n\nprint(ans)', 'N,M=map(int,input().split())\nH=list(map(int,input().split))\ncheck=[0]*N\nfor i in range(M):\n A,B=map(int,input.split)\n if H[A-1]>H[B-1]:\n check[B-1]=check[B-1]+1\n elif H[A-1]<H[B-1]:\n check[A-1]=check[A-1]+1\n else:\n check[A-1]+=1\n check[B-1]+=1\n \n \nans=check.count(0)\n\nprint(ans)', 'total_tenb,total_load=map(int,input().split())\n\nimport copy\na=list(map(int,input().split()))\nhight=copy.copy(a)\ngood_tenb=copy.copy(a)\n\n \ndef kuraberu(A,B):\n if hight[A-1]>hight[B-1]:\n good_tenb.append(height[A-1])\n good_tenb.pop(height[B-1])\n elif hight[A-1]<hight[B-1]:\n good_tenb.append(hight[B-1])\n good_tenb.pop(hight[A-1])\n \n \nfor h in range(total_load):\n A,B=map(int,input().split())\n kuraberu(A,B)\n \n \nprint(len(set(good_tenb)))\n', 'N,M=map(int,input().split())\nH=list(map(int,input().split())\ncheck=[0]*N\nfor i in range(M):\n A,B=map(int,input().split())\n if H[A-1]>H[B-1]:\n check[B-1]=check[B-1]+1\n elif H[A-1]<H[B-1]:\n check[A-1]=check[A-1]+1\n else:\n check[A-1]+=1\n check[B-1]+=1\n \n \nans=check.count(0)\n\nprint(ans)', 'total_tenb,total_load=map(int,input().split())\nhight=[]\ngood_tenb=[]\nfor i in range(total_tenb):\n a=int(input())\n hight.append(a)\n good_tenb.append(a)\n \ndef kuraberu(A,B):\n if hight[A]>hight[B]:\n good_tenb.append(height[A])\n good_tenb.pop(height[B])\n elif hight[A]<hight[B]:\n good_tenb.append(hight[B])\n good_tenb.pop(hight[A])\n \n \nfor h in range(total_load):\n A[h]=int(input())\n B[h]=int(input())\n kuraberu(A[h],B[h])\n \n \nprint(len(set(good_tenb)))', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\ncheck=[0]*N\nfor i in range(M):\n A,B=map(int,input().split())\n if H[A-1]>H[B-1]:\n check[B-1]=check[B-1]+1\n elif H[A-1]<H[B-1]:\n check[A-1]=check[A-1]+1\n else:\n check[A-1]+=1\n check[B-1]+=1\n \n \nans=check.count(0)\n\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s167461799', 's372399774', 's819640898', 's853030336', 's950238735', 's953109886', 's906297640'] | [8980.0, 10904.0, 10904.0, 20968.0, 9040.0, 10996.0, 20144.0] | [23.0, 24.0, 24.0, 48.0, 25.0, 31.0, 265.0] | [487, 311, 304, 460, 309, 476, 310] |
p02689 | u436721750 | 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())\nS=np.zeros((N,N))\nH=list(map(int,input().split()))\n\nfor j in range(M):\n a,b=map(int,input().split())\n \n if H[a-1]<H[b-1]:\n S[a-1,b-1]=-1\n S[b-1,a-1]=1\n elif H[a-1]>H[b-1]:\n S[a-1,b-1]=1\n S[b-1,a-1]=-1\n else:\n S[a-1,b-1]=-1\n S[b-1,a-1]=-1\n\ns=np.zeros(N)\nfor k in range(N+10):\n s[k]=np.any(S[k,:]<0)\n\nprint(len([i for i,x in enumerate(s) if x==0]))\n', 'mport numpy as np\nN,M=map(int,input().split())\nS=np.zeros((N,N))\nH=list(map(int,input().split()))\n\nfor j in range(M):\n a,b=map(int,input().split())\n \n if H[a-1]<H[b-1]:\n S[a-1,b-1]=-1\n S[b-1,a-1]=1\n elif H[a-1]>H[b-1]:\n S[a-1,b-1]=1\n S[b-1,a-1]=-1\n else:\n S[a-1,b-1]=-1\n S[b-1,a-1]=-1\n\ns=np.zeros(N)\nfor k in range(N):\n s[k]=np.any(S[k,:]<0)\n\nprint(len([i for i,x in enumerate(s) if x==0]))', 'import numpy as np\nN,M=map(int,input().split())\nS=np.zeros((N,N))\nH=list(map(int,input().split()))\n\nfor j in range(M):\n a,b=map(int,input().split())\n \n if H[a-1]<H[b-1]:\n S[a-1,b-1]=-1\n S[b-1,a-1]=1\n elif H[a-1]>H[b-1]:\n S[a-1,b-1]=1\n S[b-1,a-1]=-1\n else:\n S[a-1,b-1]=-1\n S[b-1,a-1]=-1\n\ns=np.zeros(N)\nfor k in range(N):\n s[k]=np.any(S[k,:]<0)\n\nprint(len([i for i,x in enumerate(s) if x==0]))\nprint(S)', 'import numpy as np\nN,M=map(int,input().split())\nS=np.ones(N)\nH=list(map(int,input().split()))\n\nfor j in range(M):\n a,b=map(int,input().split())\n \n if H[a-1]<H[b-1]:\n S[a-1]=0\n\n elif H[a-1]>H[b-1]:\n S[b-1]=0\n\n else:\n S[a-1]=0\n S[b-1]=0\n\nprint(int(np.sum(S)))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s194737423', 's448086226', 's482579939', 's352221654'] | [27268.0, 9012.0, 27260.0, 39124.0] | [115.0, 20.0, 95.0, 339.0] | [419, 414, 424, 274] |
p02689 | u437351386 | 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()))\nsum=0 \ndp=[float("INF") for i in range(n)]\nfor i in range(m):\n a,b=list(map(int,input().split()))\n if h[a-1]<h[b-1] and dp[b-1]==float("INF"):\n sum=sum+1\n dp[a-1]=0\n elif h[b-1]<h[a-1] and dp[a-1]==float("INF"):\n sum=sum+1\n dp[b-1]=0\n\nprint(n-sum)', 'n,m=list(map(int,input().split()))\nh=list(map(int,input().split()))\ndp=[float("INF") for i in range(n)]\nfor i in range(m):\n a,b=list(map(int,input().split()))\n if h[a-1]<h[b-1]:\n dp[a-1]=0\n elif h[b-1]<h[a-1]:\n dp[b-1]=0\n else:\n dp[a-1]=0\n dp[b-1]=0\nsum=0\nfor i in range(n):\n if dp[i]==float("INF"):\n sum=sum+1\nprint(sum)\n \n '] | ['Wrong Answer', 'Accepted'] | ['s810778414', 's910344608'] | [19988.0, 20052.0] | [357.0, 315.0] | [344, 347] |
p02689 | u438189153 | 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()))\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])\nres=sum([H[i]>A[i] for i in range(N)])\nprint(res)\n', 'N,M=map(int,input().split())\nhigh=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])\nres=sum(H[i]>A[i] for i in range(N))\nprint(res)\n', '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])\nres=sum([H[i]>A[i] for i in range(N)])\nprint(res)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s054719134', 's847726185', 's770647769'] | [20012.0, 20112.0, 19972.0] | [48.0, 50.0, 321.0] | [235, 233, 232] |
p02689 | u443854804 | 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())\nList=list(map(int,input().split()))\ns=[]\n\nfor i in range(m):\n a,b=list(map(int,input().split()))\n if List[a-1]>List[b-1]:\n s.append(b)\n elif List[a-1]<List[b-1]:\n s.append(a)\n else:\n s.append(a)\n s.append(b)\n \n\nprint(s)\nt=set(s) \nprint(n-len(t))\n', 'n,m=map(int,input().split())\nList=list(map(int,input().split()))\ns=[]\n\nfor i in range(m):\n a,b=list(map(int,input().split()))\n if List[a-1]>List[b-1]:\n s.append(b)\n elif List[a-1]<List[b-1]:\n s.append(a)\n else:\n s.append(a)\n s.append(b)\n \nt=set(s) \nprint(n-len(t))'] | ['Wrong Answer', 'Accepted'] | ['s906881904', 's323667168'] | [20528.0, 20088.0] | [278.0, 282.0] | [329, 318] |
p02689 | u444481227 | 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())\nheight=[int(x) for x in input().split()]\nnlist=[1]*N\nprint(nlist)\n\nfor _ in range(M):\n a, b =(int(x) for x in input().split())\n a-=1\n b-=1\n if height[a]<height[b]:\n nlist[a]=0\n\n if height[b]<height[a]:\n nlist[b]=0\n print(nlist)\n\nprint(sum(nlist))', 'N, M= (int(x) for x in input().split())\nheight=[int(x) for x in input().split()]\n#height=[8,6,9,1,2,1]\nnlist=[i for i in range(1,N+1)]\n#print(nlist)\n\nfor i in range(M):\n a, b =(int(x) for x in input().split())\n c=height.index(min(height[a-1], height[b-1]))+1\n print(c)\n if c in nlist:\n nlist.remove(c)\nprint(len(nlist))\n', 'N, M= (int(x) for x in input().split())\nheight=[int(x) for x in input().split()]\nnlist=[1]*N\nprint(nlist)\n\nfor _ in range(M):\n a, b =(int(x) for x in input().split())\n a-=1\n b-=1\n if height[a]<height[b]:\n nlist[a]=0\n\n if height[b]<height[a]:\n nlist[b]=0\n print(nlist)\n\nprint(sum(nlist))', 'N, M= (int(x) for x in input().split())\nheight=[int(x) for x in input().split()]\nnlist=[1]*N\n\nfor _ in range(M):\n a, b =(int(x) for x in input().split())\n a-=1\n b-=1\n if height[a]<=height[b]:\n nlist[a]=0\n\n if height[b]<=height[a]:\n nlist[b]=0\n\nprint(sum(nlist))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s189500364', 's968803270', 's971973865', 's157630333'] | [122896.0, 20020.0, 122876.0, 20092.0] | [2378.0, 2206.0, 2356.0, 271.0] | [318, 339, 318, 290] |
p02689 | u446808186 | 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\npair=[]\nfor _ in range(M):\n inp=list(map(int,input().split()))\n pair.append(inp)\n\nloser=[]\nfor i in range(M):\n if h[pair[i][0]]<h[pair[i][1]]:\n loser.append(pair[i][0])\n elif h[pair[i][0]]>h[pair[i][1]]:\n loser.append(pair[i][1])\n else:\n loser.append(pair[i][0])\n loser.append(pair[i][1])\n\nset_loser=set(loser)\nans=N-int(len(set_loser))\nprint(ans)', 'N,M=map(int,input().split())\nh=list(map(int,input().split()))\n\npair=[]\nfor _ in range(M):\n inp=list(map(int,input().split()))\n pair.append(inp)\n\nloser=[]\nfor i in range(M):\n if h[pair[i][0]-1]<h[pair[i][1]-1]:\n loser.append(pair[i][0])\n elif h[pair[i][0]-1]>h[pair[i][1]-1]:\n loser.append(pair[i][1])\n else:\n loser.append(pair[i][0])\n loser.append(pair[i][1])\n\nset_loser=set(loser)\nans=N-int(len(set_loser))\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s882581978', 's049175216'] | [34676.0, 34520.0] | [324.0, 345.0] | [453, 461] |
p02689 | u447456419 | 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, b = map(float, input().split())\na = int(a)\nb_int = b*100\n\nans = a*b_int/100\nans = int(ans)\nprint(ans)\n', 'n,m = map(int, input().split())\nh = list(map(int, input().split()))\nab = [list(map(int, input().split())) for i in range(m)]\n\ngood = [1]*n\n\nfor comb in ab:\n a = comb[0]-1\n b = comb[1]-1\n if h[a] <= h[b]:\n good[a] = 0\n if h[a] >= h[b]:\n good[b] = 0\n\nans = sum(good)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s464960721', 's122138510'] | [9008.0, 31960.0] | [29.0, 307.0] | [105, 301] |
p02689 | u447899880 | 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()))\nresult=list(range(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 if b in result:\n del result[b]\n elif h[a]<h[b]:\n if a in result:\n del result[a]\n else:\n if a in result:\n del result[a]\n if b in result:\n del result[b]\n\nprint(len(result))\n \n \n ', 'n,m =map(int,input().split())\nh=list(map(int,input().split()))\nresult=[1]*n\nfor i in range(m):\n a,b =map(int,input().split())\n a-=1\n b-=1\n if h[a]>h[b]:\n result[b]=0\n elif h[a]<h[b]:\n result[a]=0\n else:\n result[a]=0\n result[b]=0\n\nprint(sum(result))\n \n \n '] | ['Runtime Error', 'Accepted'] | ['s061926816', 's528582283'] | [20024.0, 20072.0] | [1790.0, 256.0] | [454, 325] |
p02689 | u449580152 | 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()))\ns = [[0]]*m\n \nfor _ in range(m):\n a, b = map(int, input().split())\n s[a-1].append(H[b-1])\n s[b-1].append(H[a-1])\n \nc = 0\nfor j in range(n):\n if H[j] > max(s[j]):\n c+= 1\n \nprint(c) \n', 'n, m = map(int, input().split())\nH = list(map(int, input().split()))\nS = []\nc = 0\nb = []\n \nfor i in range(m):\n S.append(list(map(int, input().split())))\n \nfor j in range(n):\n for k in range(m):\n if j in S[k]:\n if S[k][0] == j:\n if H[S[k][0]] < H[S[k][1]]:\n c += 1\n else:\n if H[S[k][0]] > H[S[k][1]]:\n c + = 1\n if c == 0:\n b.append(j)\n c = 0\n \nprint(len(b))', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\nS = []\nc = 0\nb = []\n\nfor i in range(m):\n S.append(list(map(int, input()split())))\n\nfor j in range(n):\n for k in range(m):\n if j in S[k]:\n if S[k][0] == j:\n if S[k][0] < S[k][1]:\n c += 1\n else:\n if S[k][0] > S[k][1]:\n c + = 1\n if c ==0:\n b.append(j)\n\nprint(len(b))', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\ns = [[0]]*n\n \nfor _ in range(m):\n a, b = map(int, input().split())\n s[a-1].append(H[b-1])\n s[b-1].append(H[a-1])\n \nc = 0\nfor j in range(n):\n if H[j] > max(s[j]):\n c+= 1\n \nprint(c) \n', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\ns = [[0]]*m\n\nfor i in range(m):\n a, b = map(int, input().split())\n s[a-1].append(H[b-1])\n s[b-1].append(H[a-1])\n\nc = 0\nfor j in range(n):\n if H[j] > max(s[j]):\n c+= 1\n\nprint(c) ', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\ns = [[0]]*n\n \nfor _ in range(m):\n road = list(map(int, input().split()))\n s[road[0]-1].append(H[road[1]-1])\n s[road[1]-1].append(H[road[0]-1])\n \nc = 0\nfor j in range(n):\n if H[j] > max(s[j]):\n c+= 1\n \nprint(c) \n', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\nS = []\nc = 0\nb = []\n \nfor i in range(m):\n S.append(list(map(int, input().split())))\n \nfor j in range(n):\n for k in range(m):\n if j in S[k]:\n if S[k][0] == j:\n if S[k][0] < S[k][1]:\n c += 1\n else:\n if S[k][0] > S[k][1]:\n c + = 1\n if c ==0:\n b.append(j)\n \nprint(len(b))', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\ns = [[0]]*n\nfor i in range(m):\n a, b = map(int, input().split())\n s[a-1].append(H[b-1])\n s[b-1].append(H[a-1])\nc = 0\nfor j in range(n):\n if H[j] > max(s[j]):\n c+= 1\nprint(c) \n', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\ns = [[0] for i in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n s[a-1].append(H[b-1])\n s[b-1].append(H[a-1])\nc = 0\nfor j in range(n):\n if H[j] > max(s[j]):\n c+= 1\n print(c) \n', 'n,m = map(int, input().split())\nH = list(map(int, input().split()))\ns = [[0] for i in range(n)]\nfor i in range(m):\n a, b = map(int, input().split())\n s[a-1].append(H[b-1])\n s[b-1].append(H[a-1])\nc = 0\nfor j in range(n):\n if H[j] > max(s[j]):\n c+= 1\nprint(c) '] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s005587724', 's032814259', 's268035203', 's375954930', 's413070712', 's434789407', 's601847856', 's608207625', 's674200564', 's232289075'] | [19976.0, 9008.0, 8912.0, 19912.0, 20064.0, 20056.0, 9068.0, 20072.0, 9060.0, 26048.0] | [2206.0, 22.0, 22.0, 2206.0, 2206.0, 2206.0, 21.0, 2206.0, 22.0, 379.0] | [269, 472, 444, 269, 267, 299, 448, 262, 279, 277] |
p02689 | u451206510 | 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 = [[] for i in range(N+1)]\nfor i in range(N+1):\n A[i].append(H[i-1])\nfor i in range(M):\n a,b = map(int, input().split())\n A[a].append(H[b-1])\n A[b].append(H[a-1])\n\nans = 0\nfor i in range(1,N+1):\n print(A[i])\n if max(A[i]) == A[i][0] :\n ans += 1\n\n if len(A[i]) != 1 and len(set(A[i])) == 1:\n ans -= 1\nprint(ans)\n', 'N,M = map(int, input().split())\nH = list(map(int, input().split()))\n\nA = [[] for i in range(N+1)]\nfor i in range(N+1):\n A[i].append(H[i-1])\nfor i in range(M):\n a,b = map(int, input().split())\n A[a].append(H[b-1])\n A[b].append(H[a-1])\n\nans = 0\nfor i in range(1,N+1):\n if max(A[i]) == A[i][0] and A[i].count(A[i][0]) < 2:\n ans += 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s492969412', 's436431469'] | [27880.0, 24120.0] | [527.0, 398.0] | [417, 364] |
p02689 | u452512115 | 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\nAB = [tuple(map(int, input().split())) for i in range(M)]\n\ngraph = [[] for _ in range(N)]\n\nfor a, b in AB:\n a, b = a-1, b-1\n graph[a].append(b)\n graph[b].append(a)\n\n ans = 0\n\nfor i, h in enumerate(H):\n for to in graph[i]:\n if H[to] >= H[i]:\n break\n else:\n ans += 1\n \nprint(ans)', 'N, M = map(int, input().split())\n\nH = list(map(int, input().split()))\n\n\n\n\ngraph = [[] for _ in range(N)]\n\nfor _ in range(M):\n a, b = map(int, input().split())\n graph[a-1].append(b-1)\n graph[b-1].append(a-1)\n\n ans = 0\n\nfor n in range(N):\n flag = True\n for to in graph[n]:\n if H[n] <= H[to]:\n flag = False\n \n if flag:\n ans += 1\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s632816549', 's994432677'] | [42868.0, 29416.0] | [382.0, 360.0] | [370, 458] |
p02689 | u453623947 | 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 = [input().split() for i in range(m)]\n\nlist = [0]*n\nfor j in range(m):\n if h[int(l[j][0])-1] > h[int(l[j][1])-1]:\n list[int(l[j][1])-1] -= 1\n elif h[int(l[j][0])-1] < h[int(l[j][1])-1]:\n list[int(l[j][0])-1] -= 1\n else :\n list[int(l[j][0])-1] -= 1\n list[int(l[j][1])-1] -= 1\n\nprint(list)\nprint(list.count(0))', 'n,m=map(int, input().split())\nh = list(map(int, input().split()))\nl = [input().split() for i in range(m)]\n\nlist = [0]*n\nfor j in range(m):\n if h[int(l[j][0])-1] > h[int(l[j][1])-1]:\n list[int(l[j][1])-1] -= 1\n elif h[int(l[j][0])-1] < h[int(l[j][1])-1]:\n list[int(l[j][0])-1] -= 1\n else :\n list[int(l[j][0])-1] -= 1\n list[int(l[j][1])-1] -= 1\n\nprint(list.count(0))'] | ['Wrong Answer', 'Accepted'] | ['s374629784', 's840596575'] | [43892.0, 43172.0] | [343.0, 368.0] | [414, 402] |
p02689 | u455957070 | 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())\nA = []\nB = []\nans = 0\nH = list(map(int,input().split()))\nfor i in range(m-1):\n a, b = map(int, input().split())\n A.append(int(a))\n B.append(int(b))\nfor i in range(m-1):\n if H[(A[i])-1] < H[(B[i])-1]:\n ans += 1\nfor i in range(m-1):\n if A.count(i) == 0 and B.count(i) == 0:\n ans += 1\nfor i in range(m-1):\n for j in range(m-1):\n if A[i] == B[j] and B[i] == A[j]:\n ans += 1\nprint(ans)', 'n, m = map(int,input().split())\nh = list(map(int,input().split()))\nbads = set()\nans = n\nfor i in range(m):\n a, b = map(int,input().split())\n a -= 1 \n b -= 1\n if a not in bads and h[a] <= h[b]:\n bads.add(a)\n ans -= 1\n if b not in bads and h[a] >= h[b]:\n bads.add(b)\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s971203850', 's980299665'] | [22508.0, 20104.0] | [2206.0, 276.0] | [438, 323] |
p02689 | u461833298 | 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(x) for x in input().split()]\nAB = [[int(x) for x in input().split()] for _ in range(M)]\n\nli = [0] + [-1] * N\nfor a, b in AB:\n ma = max(H[a-1], H[b-1])\n if ma==H[a-1]:\n li[b]=-4\n# elif ma==H[b-1]:\n# li[a]=-4\n else:\n li[a]=-4\n li[b]=-4\n\n# if H[a-1]>H[b-1]:\n# li[b]=-4\n# elif H[b-1]>H[a-1]:\n# li[a]=-4\n# else:\n# li[a] = li[b] = -4\n\ncnt=0\n\nfor i in range(N+1):\n if i==0:\n continue\n if li[i]==-4:\n cnt+=1\nprint(N-cnt)', 'N, M = map(int, input().split())\nH = [int(x) for x in input().split()]\nAB = [[int(x) for x in input().split()] for _ in range(M)]\n\nli = [0] + [-1] * N\nfor a, b in AB:\n# ma = max(H[a-1], H[b-1])\n# if ma==H[a-1]:\n# li[b]=-4\n# elif ma==H[b-1]:\n# li[a]=-4\n# else:\n# li[a]=-4\n# li[b]=-4\n\n# if H[a-1]>H[b-1]:\n# li[b]=-4\n# elif H[b-1]>H[a-1]:\n# li[a]=-4\n# else:\n# li[a] = li[b] = -4\n \n if H[a-1]>H[b-1]:\n li[b]=-4\n elif H[b-1]==H[a-1]:\n li[a] = li[b] = -4\n else:\n li[a]=-4\n\ncnt=0\n\nfor i in range(N+1):\n if i==0:\n continue\n if li[i]==-4:\n cnt+=1\nprint(N-cnt)'] | ['Wrong Answer', 'Accepted'] | ['s215299121', 's211034664'] | [31136.0, 31284.0] | [323.0, 292.0] | [552, 691] |
p02689 | u469281291 | 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 math\n\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nma = [0] * n\nfor i in range(m):\n a, b = map(int, input().split())\n ma[a - 1] = max(ma[a-1],h[b - 1])\n ma[b - 1] = max(ma[b-1] ,h[a - 1])\ncnt = 0\nprint(ma)\nprint(h)\nfor i in range(n):\n if h[i] > ma[i]:\n cnt += 1\nprint(cnt)\n', 'import sys\nimport math\n\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nma = [0] * n\nfor i in range(m):\n a, b = map(int, input().split())\n ma[a - 1] = max(h[a - 1],max(ma[a-1],h[b - 1]))\n ma[b - 1] = max(h[b - 1],max(ma[b-1] ,h[a - 1]))\ncnt = 0\nfor i in range(n):\n if h[i] > ma[i]:\n cnt += 1\nprint(cnt)\n', 'import sys\nimport math\nn, m = map(int, input().split())\nh=list(map(int,input().split()))\nbli = h\nfor i in range(m):\n a, b = map(int, input().split())\n bli[a - 1] = max(bli[a - 1], b)\ncnt=0\nfor i in range(n):\n if (h[i] == bli[i]):\n cnt += 1\nprint(cnt)', 'import sys\nimport math\n\nn, m = map(int, input().split())\nh = list(map(int, input().split()))\nma = [0] * n\nfor i in range(m):\n a, b = map(int, input().split())\n ma[a - 1] = max(ma[a-1],h[b - 1])\n ma[b - 1] = max(ma[b-1] ,h[a - 1])\ncnt = 0\nfor i in range(n):\n if h[i] > ma[i]:\n cnt += 1\nprint(cnt)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s739217319', 's945843841', 's976165770', 's902198414'] | [20100.0, 20012.0, 20028.0, 20120.0] | [348.0, 362.0, 266.0, 317.0] | [334, 343, 266, 315] |
p02689 | u471503862 | 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())\nO = list(map(int, input().split()))\nB = [[] for i in range(N)]\n \nfor j in range(M):\n o_1, o_2 = map(int, input().split())\n B[o_1-1].append(o_2-1)\n B[o_2-1].append(o_1-1)\n \nprint(B)\n\nans = 0\nfor node in range(N):\n flag =1\n for l in B[node]:\n if O[node] <= O[l]:\n flag = 0\n if flag ==1:\n ans += 1\nprint(ans)\n ', 'N, M = map(int, input().split())\nO = list(map(int, input().split()))\nB = [[] for i in range(N)]\n \nfor j in range(M):\n o_1, o_2 = map(int, input().split())\n B[o_1-1].append(o_2-1)\n B[o_2-1].append(o_1-1)\n\nans = 0\nfor node in range(N):\n flag =1\n for l in B[node]:\n if O[node] <= O[l]:\n flag = 0\n if flag ==1:\n ans += 1\nprint(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s010902460', 's668736520'] | [33356.0, 29344.0] | [454.0, 373.0] | [364, 352] |
p02689 | u473433753 | 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 ai,bi=list(map(int, input("").split()))\n a.append(ai)\n b.append(bi)\nma=0\nout=0\nfor i in range(n):\n ma=h[i]\n q=h[i]\n for j in range(m):\n if i==a[j]-1 or i==b[j]-1:\n if i==a[j]-1:\n if h[b[j]-1] >= ma:\n ma=0\n else:\n if h[a[j]-1] >= ma:\n ma=0\n print(ma,q)\n if ma==q: \n out+=1\nprint(out)', 'n,m=list(map(int, input("").split()))\nh=list(map(int, input("").split()))\no=[]\nfor i in range(n):\n o.append(1)\nfor i in range(m):\n a,b=list(map(int, input("").split()))\n if h[a-1] <=h[b-1]:\n o[a-1]=0\n if h[a-1] >=h[b-1]:\n o[b-1]=0\nprint(sum(o))'] | ['Wrong Answer', 'Accepted'] | ['s824480535', 's383878140'] | [22536.0, 19988.0] | [2206.0, 286.0] | [515, 270] |
p02689 | u476124554 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['n,m = map(int,input().split())\nh = list(map(int,input().split()))\nans = 0\narr = [[] for i in range(n)]\nfor i in range(m):\n a,b = map(int,input().split())\n arr[a-1].append(b-1)\n arr[b-1].append(a-1)\n\nfor i in range(len(h)):\n tmph = h[i]\n flg = 1\n if arr[i]:\n for j in arr[i]:\n if tmph <= h[j]:\n flg = 0\n break\n if flg == 1:\n ans +=1\n print(i)\nprint(ans)', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\nans = 0\narr = [[] for i in range(n)]\nfor i in range(m):\n a,b = map(int,input().split())\n arr[a-1].append(b-1)\n arr[b-1].append(a-1)\n\nfor i in range(len(h)):\n tmph = h[i]\n flg = 1\n if arr[i]:\n for j in arr[i]:\n if tmph <= h[j]:\n flg = 0\n break\n if flg == 1:\n ans +=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s243149235', 's748979499'] | [29552.0, 29348.0] | [390.0, 366.0] | [435, 418] |
p02689 | u479612543 | 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 = {}\nfor k, v in zip(range(1,n+1),[k for k in map(int, input().split())]):\n h[k] = v \n\nmiti = []\nfor i in range(m):\n temp = [k for k in map(int, input().split())]\n miti.append(temp)\n\nx = np.zeros(n)\n\nfor i in range(m):\n if h[miti[i][0]] < h[miti[i][1]]:\n x[miti[i][0]-1] =+1\n elif h[miti[i][0]] > h[miti[i][1]]:\n x[miti[i][1]-1] =+1\n elif h[miti[i][0]] == h[miti[i][1]]:\n x[miti[i][0]-1] =+1\n x[miti[i][1]-1] =+1\n\nprint(sum(x == 0))\n', 'import numpy as np\n\nn, m = map(int, input().split())\n\nh = {}\nfor k, v in zip(range(1,n+1),[k for k in map(int, input().split())]):\n h[k] = v \n\nmiti = []\nfor i in range(m):\n temp = [k for k in map(int, input().split())]\n miti.append(temp)\n\nx = np.zeros(n)\n\nfor i in range(m):\n if h[miti[i][0]] < h[miti[i][1]]:\n x[miti[i][0]-1] =+1\n elif h[miti[i][0]] > h[miti[i][1]]:\n x[miti[i][1]-1] =+1\n elif h[miti[i][0]] == h[miti[i][1]]:\n x[miti[i][0]-1] =+1\n x[miti[i][1]-1] =+1\n\nprint(sum(x == 0))\n'] | ['Runtime Error', 'Accepted'] | ['s229498634', 's345398117'] | [37984.0, 56248.0] | [267.0, 629.0] | [515, 535] |
p02689 | u481550011 | 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()))\ngood=[True]*N\nfor i in range(M):\n A,B=map(int,input().split())\n if H[A-1]>H[B-1]:\n print("A")\n good[B-1]=False\n elif H[B-1]>H[A-1]:\n good[A-1]=False\n else:\n good[A-1],good[B-1]=False,False\nans=0\nfor i in good:\n if i==True:\n ans+=1\nprint(good)', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\ngood=[True]*N\nfor i in range(M):\n A,B=map(int,input().split())\n if H[A-1]>H[B-1]:\n good[B-1]=False\n elif H[B-1]>H[A-1]:\n good[A-1]=False\n else:\n good[A-1],good[B-1]=False,False\nans=0\nfor i in good:\n if i==True:\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s805788864', 's612643034'] | [20128.0, 20044.0] | [423.0, 260.0] | [354, 334] |
p02689 | u483298903 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['N,M=map(int,input().split())\nH = list(map(int,input().split()))\nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i],B[i]=map(int,input().split())\nlist = []\nfor i in range(M):\n if H[A[i]-1]>=H[B[i]-1]:\n list.append(B[i])\n elif H[A[i]-1]<=H[B[i]-1]:\n list.append(A[i])\nprint("N:{} M:{} H:{} list:{} set(list):{}".format(N,M,H,list,set(list)))\nprint(N-len(set(list)))', 'N,M=map(int,input().split())\nH = list(map(int,input().split()))\nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i],B[i]=map(int,input().split())\nlist = []\nfor i in range(M):\n if H[A[i]-1]>=H[B[i]-1]:\n list.append(B[i])\n else:\n list.append(A[i])\nprint("N:{} M:{} H:{} list:{} set(list):{}".format(N,M,H,list,set(list)))\nprint(N-len(set(list)))', 'N,M=map(int,input().split())\nH = list(map(int,input().split()))\nA = [0]*M\nB = [0]*M\nfor i in range(M):\n A[i],B[i]=map(int,input().split())\nlist = []\nfor i in range(M):\n if H[A[i]-1]>=H[B[i]-1]:\n list.append(B[i])\n if H[A[i]-1]<=H[B[i]-1]:\n list.append(A[i])\n#print("N:{} M:{} H:{} list:{} set(list):{}".format(N,M,H,list,set(list)))\nprint(N-len(set(list)))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s539731282', 's691988165', 's077026150'] | [27028.0, 27168.0, 24372.0] | [305.0, 296.0, 283.0] | [366, 345, 365] |
p02689 | u490553751 | 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? | ['#template\ndef inputlist(): return [int(k) for k in input().split()]\n#template\nN,M = inputlist()\nH = inputlist()\ngraph = [[] for _ in range(N)]\nprint(graph)\n\nfor i in range(M):\n A,B = inputlist()\n A -=1\n B -=1\n graph[A].append(B)\n graph[B].append(A)\nans = 0\nfor i in range(N):\n h = H[i]\n k = 0\n for j in graph[i]:\n k = max(k,H[j])\n if h > k:\n ans +=1\nprint(ans)\n', '#template\ndef inputlist(): return [int(k) for k in input().split()]\n#template\nN,M = inputlist()\nH = inputlist()\ngraph = [[] for _ in range(N)]\n\nfor i in range(M):\n A,B = inputlist()\n A -=1\n B -=1\n graph[A].append(B)\n graph[B].append(A)\nans = 0\nfor i in range(N):\n h = H[i]\n k = 0\n for j in graph[i]:\n k = max(k,H[j])\n if h > k:\n ans +=1\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s969368497', 's997359365'] | [30204.0, 29576.0] | [446.0, 452.0] | [402, 389] |
p02689 | u496018856 | 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? | ['input1 = input().rstrip().split(" ")\nh = input().rstrip().split(" ")\nyoi = [1 for i in range(int(input1[0]))]\n\n# print(h)map(int, input().split())\nroot = [input().rstrip().split(" ") for i in range(int(input1[1]))]\n\n\nprint(int(root[0][1]))\nfor i in range(int(input1[1])):\n a=int(root[i][0])-1\n b=int(root[i][1])-1\n if h[a]> h[b]:\n # if yoi[a] == 0:\n # yoi[a] = 1\n yoi[b] = 0\n elif h[a] < h[b]:\n # if yoi[a] == 0:\n # yoi[a] = 1\n yoi[a] = 0\n else:\n # if yoi[b] == 0:\n # yoi[b] = 1\n yoi[a] = 0\n yoi[b] = 0\nprint (sum(yoi))\n', 'N,M=map(int, input().split())\nH=list(map(int, input().split()))\nflag=[1]*N\nfor i in range(M):\n A,B=map(int, input().split())\n if H[A-1]>H[B-1]:\n flag[B-1]=0 \n elif H[A-1]<H[B-1]:\n flag[A-1]=0\n else:\n flag[A-1]=0\n flag[B-1]=0\nprint(sum(flag))'] | ['Wrong Answer', 'Accepted'] | ['s518478154', 's353353601'] | [46812.0, 19972.0] | [308.0, 258.0] | [744, 281] |
p02689 | u497805118 | 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\ncandidates = {}\nfor i in range(m):\n x, y = map(int, input().split(" "))\n\n if h[x - 1] <= h[y -1]:\n candidates[x] = False\n if h[x - 1] >= h[y -1]:\n candidates[y] = False\n print(x, y , candidates)\n\nans = 0\nfor i in range(1, n + 1):\n is_highest = candidates.get(i, True)\n if is_highest:\n ans += 1\n\nprint(ans)', 'n, m = map(int ,input().split(" "))\nh = list(map(int, input().split(" ")))\n\ncandidates = {}\nfor i in range(m):\n x, y = map(int, input().split(" "))\n\n if h[x - 1] <= h[y -1]:\n candidates[x] = False\n if h[x - 1] >= h[y -1]:\n candidates[y] = False\n\nans = 0\nfor i in range(1, n + 1):\n is_highest = candidates.get(i, True)\n if is_highest:\n ans += 1\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s781845339', 's163273391'] | [142000.0, 20116.0] | [1750.0, 288.0] | [420, 391] |
p02689 | u502508885 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['n, m = list(map(int, input().split()))\n\nh = list(map(int, input().split()))\nprint(h)\n\nyoi_warui = [0]*(n)\ndokuritsu = [0]*(n)\n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n dokuritsu[a-1] = 1\n dokuritsu[b-1] = 1\n if h[a-1] < h[b-1]:\n yoi_warui[a-1] = 1\n elif h[b-1] < h[a-1]:\n yoi_warui[b-1] = 1\n\nprint(yoi_warui.count(0)- dokuritsu.count(0))\n', 'n, m = list(map(int, input().split()))\n\nh = list(map(int, input().split()))\n\nyoi_warui = [0]*n\ndokuritsu = [0]*n\n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n dokuritsu[a-1] = 1\n dokuritsu[b-1] = 1\n if h[a-1] == h[b-1]:\n yoi_warui[a-1] = 1\n yoi_warui[b-1] = 1\n elif h[a-1] < h[b-1]:\n yoi_warui[a-1] = 1\n elif h[b-1] < h[a-1]:\n yoi_warui[b-1] = 1\n\nprint(yoi_warui)\nprint(dokuritsu)\n\nprint(yoi_warui.count(0))\n\n', 'n, m = list(map(int, input().split()))\n\nh = list(map(int, input().split()))\n\nyoi_warui = [0]*n\ndokuritsu = [0]*n\n\nfor i in range(m):\n a, b = list(map(int, input().split()))\n dokuritsu[a-1] = 1\n dokuritsu[b-1] = 1\n if h[a-1] == h[b-1]:\n yoi_warui[a-1] = 1\n yoi_warui[b-1] = 1\n elif h[a-1] < h[b-1]:\n yoi_warui[a-1] = 1\n elif h[b-1] < h[a-1]:\n yoi_warui[b-1] = 1\n\nprint(yoi_warui.count(0))\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s564197372', 's902927667', 's478449539'] | [20036.0, 20140.0, 19968.0] | [305.0, 320.0, 330.0] | [386, 470, 435] |
p02689 | u508426820 | 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 = [0] + list(map(int, input().split()))\nkouho = [i + 1 for i in range(N)]\nfor i in range(M):\n a, b = map(int, input(),split())\n if H[a] > H[b] and b in kouho:\n kouho.remove(b)\n elif H[a] < H[b] and a in kouho:\n kouho.remove(a)\n elif H[a] == H[b]:\n if a in kouho:\n kouho.remove(a)\n if b in kouho:\n kouho.remove(b)\nprint(len(kouho))\n', 'N, M = map(int, input().split())\nH = [0] + list(map(int, input().split()))\nkouho = set([i + 1 for i in range(N)])\nhazure = set()\nfor i in range(M):\n a, b = map(int, input().split())\n Ha = H[a]\n Hb = H[b]\n if Ha >= Hb:\n hazure.add(b)\n if Ha <= Hb:\n hazure.add(a)\nans = kouho - hazure\nprint(len(ans))\n'] | ['Runtime Error', 'Accepted'] | ['s709901981', 's740079508'] | [19964.0, 26924.0] | [48.0, 302.0] | [428, 328] |
p02689 | u512212329 | 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(x) for x in input().split()]\n heights = tuple(int(x) for x in input().split())\n adjacents_heights = [set() for _ in range(n)]\n print(heights)\n for i in range(m):\n a, b = [int(x) - 1 for x in input().split()]\n adjacents_heights[a].add(heights[b])\n adjacents_heights[b].add(heights[a])\n ans = 0\n print(adjacents_heights)\n for h, ahs in zip(heights, adjacents_heights):\n if not ahs:\n ans += 1\n continue\n elif h > max(ahs):\n ans += 1\n\n return ans\n\n\nif __name__ == '__main__':\n print(main())\n", "def main():\n n, m = [int(x) for x in input().split()]\n heights = tuple(int(x) for x in input().split())\n checked = [1] * n\n for i in range(m):\n a, b = [int(x) - 1 for x in input().split()]\n h_a = heights[a]\n h_b = heights[b]\n if h_a < h_b:\n checked[a] = 0\n elif h_a > h_b:\n checked[b] = 0\n else:\n checked[a] = 0\n checked[b] = 0\n\n return sum(checked)\n\n\nif __name__ == '__main__':\n print(main())\n"] | ['Wrong Answer', 'Accepted'] | ['s924512652', 's003697698'] | [45184.0, 20048.0] | [503.0, 234.0] | [610, 498] |
p02689 | u515052479 | 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\n\n#seen = np.zeros((n,n))\n\n\n# a,b = map(int,input().split())\n\n\n \nans = 0\n\n\n# temp_1 = np.max(temp)\n# if (h[i] > temp_1) and (temp_1 != 0):\n# ans += 1\n# elif temp_1 == 0:\n# ans += 1\n \nprint(ans)', 'import numpy as np\n\nn,m = map(int,input().split())\nh = list(map(int,input().split()))\n\n\nseen = np.zeros((n,n))\ntemp = 1\n\n\n# a,b = map(int,input().split())\n\n\n \nans = 0\nfor i in range(n):\n temp = np.multiply(seen[i],h)\n temp_1 = np.max(temp)\n if (h[i] > temp_1) and (temp_1 != 0):\n ans += 1\n elif temp_1 == 0:\n ans += 1\n \nprint(ans)', 'import numpy as np\n\nn,m = map(int,input().split())\nh = list(map(int,input().split()))\n\n\nseen = np.zeros((n,n))\ntemp = 1\n\nfor i in range(m):\n a,b = map(int,input().split())\n seen[a-1,b-1] = 1\n seen[b-1,a-1] = 1\n \nans = 0\n\n\n# temp_1 = np.max(temp)\n# if (h[i] > temp_1) and (temp_1 != 0):\n# ans += 1\n# elif temp_1 == 0:\n# ans += 1\n \nprint(ans)', 'import numpy as np\n\nn,m = map(int,input().split())\nh = list(map(int,input().split()))\n\n\nseen = np.zeros((n,n))\n\n\n# a,b = map(int,input().split())\n\n\n \nans = 0\n\n\n# temp_1 = np.max(temp)\n# if (h[i] > temp_1) and (temp_1 != 0):\n# ans += 1\n# elif temp_1 == 0:\n# ans += 1\n \nprint(ans)', 'import numpy as np\n\nn,m = map(int,input().split())\nh = np.array(list(map(int,input().split())))\n\nbase = np.zeros(n)\nseen = np.zeros((n,n))\n\n\n# a,b = map(int,input().split())\n\n\n \nans = 0\n\n\n# temp_1 = np.max(temp)\n# if (h[i] > temp_1) and (temp_1 != 0):\n# ans += 1\n# elif temp_1 == 0:\n# ans += 1\n \nprint(ans)', 'import numpy as np\nn,m = map(int,input().split())\nh = list(map(int,input().split()))\n\nbase = np.ones(n)\n\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] > h[b-1]:\n base[b-1] = 0\n elif h[a-1] < h[b-1]:\n base[a-1] = 0\n elif h[a-1] == h[b-1]:\n base[a-1] = 0\n base[b-1] = 0\n \nprint(int(np.sum(base)))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s369926092', 's388974520', 's426819143', 's629709238', 's690989158', 's384921593'] | [38616.0, 38376.0, 38352.0, 38416.0, 38280.0, 38468.0] | [135.0, 133.0, 128.0, 130.0, 133.0, 345.0] | [432, 423, 426, 421, 430, 330] |
p02689 | u517910772 | 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 c():\n N, M = map(int, input().split())\n \n H = list(map(int, input().split()))\n\n \n G = {}\n for i in range(M):\n A, B = map(int, input().split())\n G[A-1] = max(G.get(A-1, 0), H[B-1])\n G[B-1] = max(G.get(B-1, 0), H[A-1])\n cnt = 0\n print(G)\n for j in range(N):\n if j in G.keys() and H[j] > G[j]:\n cnt += 1\n print(cnt)\n\n\n##########\nif __name__ == "__main__":\n c()\n', 'def c():\n N, M = map(int, input().split())\n \n H = list(map(int, input().split()))\n\n \n G = {}\n for i in range(M):\n A, B = map(int, input().split())\n G[A-1] = max(G.get(A-1, 0), H[B-1])\n G[B-1] = max(G.get(B-1, 0), H[A-1])\n cnt = 0\n for j in range(N):\n if j in G.keys() and H[j] > G[j]:\n cnt += 1\n elif j not in G.keys():\n cnt += 1\n print(cnt)\n\n\n##########\nif __name__ == "__main__":\n c()\n'] | ['Wrong Answer', 'Accepted'] | ['s984008667', 's245129094'] | [21144.0, 20092.0] | [395.0, 340.0] | [492, 532] |
p02689 | u518242261 | 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\nN_addj = [[] for i in range(N)]\n\nfor i in range(M):\n AB = list(map(int, input().split()))\n N_addj[AB[0]-1].append(AB[1]-1)\n N_addj[AB[1]-1].append(AB[0]-1)\n\n\nN_memo = [0] * N\n\nnum = 0\n\n\narr = []\n\nprint(H)\n\n\nfor i in range(N):\n flag = True\n for j in N_addj[i]:\n if(H[i] <= H[j]):\n flag = False\n break\n if(flag):\n num = num + 1\n\nprint(num)\n', 'N, M = map(int, input().split())\n\nH = list(map(int, input().split()))\n\nN_addj = [[] for i in range(N)]\n\nfor i in range(M):\n AB = list(map(int, input().split()))\n N_addj[AB[0]-1].append(AB[1]-1)\n N_addj[AB[1]-1].append(AB[0]-1)\n\n\nN_memo = [0] * N\n\nnum = 0\n\n\narr = []\n\n\nfor i in range(N):\n flag = True\n for j in N_addj[i]:\n if(H[i] <= H[j]):\n flag = False\n break\n if(flag):\n num = num + 1\n\nprint(num)\n'] | ['Wrong Answer', 'Accepted'] | ['s393653257', 's672022814'] | [33388.0, 30240.0] | [401.0, 419.0] | [463, 453] |
p02689 | u519123891 | 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? | ['# input\ninp_ls = input().split(" ")\nn,m = [int(e) for e in inp_ls[:2]]\nh_ls = [int(e) for e in input().split(" ")[:n]]\n\n# calc\nraw_obs_dic = {i+1: [] for i in range(n)}\nfor i in range(m):\n\ta,b = [int(e) for e in input().split(" ")[:2]]\n\traw_obs_dic[a].append(b)\n\traw_obs_dic[b].append(a)\n\n\nobs_dic = {k:list(set(raw_obs_dic[k])) for k in raw_obs_dic}\nprint(obs_dic)\n\ncnt = 0\nfor o0 in obs_dic:\n\t\n\t# if len(obs_dic[o0]) < 1:\n\t\n\t# \tcontinue\n\t# compare height\n\to0_h = h_ls[o0-1]\n\tflag = True\n\tfor o1 in obs_dic[o0]:\n\t\to1_h = h_ls[o1-1]\n\t\tif o0_h <= o1_h: flag = False\n\tprint(o0, flag)\n\tif flag is True: cnt += 1\n\n# result\nprint(cnt)', '# input\ninp_ls = input().split(" ")\nn,m = [int(e) for e in inp_ls[:2]]\nh_ls = [int(e) for e in input().split(" ")[:n]]\n\n# calc\nraw_obs_dic = {i+1: [] for i in range(n)}\nfor i in range(m):\n\ta,b = [int(e) for e in input().split(" ")[:2]]\n\traw_obs_dic[a].append(b)\n\traw_obs_dic[b].append(a)\n\n\nobs_dic = {k:list(set(raw_obs_dic[k])) for k in raw_obs_dic}\n# print(obs_dic)\n\ncnt = 0\nfor o0 in obs_dic:\n\t\n\t# if len(obs_dic[o0]) < 1:\n\t\n\t# \tcontinue\n\t# compare height\n\to0_h = h_ls[o0-1]\n\tflag = True\n\tfor o1 in obs_dic[o0]:\n\t\to1_h = h_ls[o1-1]\n\t\tif o0_h <= o1_h: flag = False\n\t# print(o0, flag)\n\tif flag is True: cnt += 1\n\n# result\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s842968441', 's753677990'] | [55584.0, 55480.0] | [687.0, 562.0] | [661, 665] |
p02689 | u520843951 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['n, m = map(int, input().split())\nh = list(map(int, input().split()))\n\ntmp = [1] * n\n\nab = [map(int, input().split()) for _ in range(M)]\na, b = [list(i) for i in zip(*ab)]\n\nfor i in range(m):\n if h[a[i] - 1] > h[b[i] - 1]:\n tmp[b[i] - 1] = 0\n elif h[a[i] - 1] < h[b[i] - 1]:\n tmp[a[i] - 1] = 0\n else:\n tmp[a[i] - 1] = 0\n tmp[b[i] - 1] = 0\n\nprint(sum(tmp))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\n\ntmp = [1] * n\n\nab = [map(int, input().split()) for _ in range(m)]\na, b = [list(i) for i in zip(*ab)]\n\nfor i in range(m):\n if h[a[i] - 1] > h[b[i] - 1]:\n tmp[b[i] - 1] = 0\n elif h[a[i] - 1] < h[b[i] - 1]:\n tmp[a[i] - 1] = 0\n else:\n tmp[a[i] - 1] = 0\n tmp[b[i] - 1] = 0\n\nprint(sum(tmp))'] | ['Runtime Error', 'Accepted'] | ['s237558659', 's289161936'] | [20120.0, 67796.0] | [44.0, 449.0] | [391, 391] |
p02689 | u522937309 | 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()) \nlist_h=list(map(int, input().split())) \n\na = []\nfor i in range(m):\n ai = list(map(int, input().split())) \n a.append(ai)\n\nbooler = [True] * n\nfor i in range(n):\n a_copy = copy.deepcopy(a)\n for j in range(m):\n if i in a_copy[j] :\n a_copy[j].remove(i)\n# print(a_copy)\n if list_h[i] > list_h[a_copy[j][0]-1]:\n continue\n else:\n booler[i] = False\n else:\n continue\n\nprint(booler.count(True))', 'x = int(input())\nfor i in range(-118, 119):\n for j in range(-119, 118):\n if i**5 - j**5 == x:\n print(i,j)\n break\n else:\n continue\n break', 'import copy\nn, m =map(int, input().split()) \nlist_h=list(map(int, input().split())) \n\na = []\nfor i in range(m):\n ai = list(map(int, input().split())) \n a.append(ai)\n\nfor i in a:\n i.sort()\na = list(map(list, set(map(tuple, a))))\n\nbooler = [True] * n\nfor j in a:\n if list_h[j[0]-1] < list_h[j[1]-1]:\n booler[j[0]-1] = False\n elif list_h[j[0]-1] > list_h[j[1]-1]:\n booler[j[1]-1] = False\n else :\n booler[j[0]-1] = False\n booler[j[1]-1] = False\nprint(booler.count(True))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s799037042', 's883359698', 's394988560'] | [31888.0, 9176.0, 50484.0] | [253.0, 21.0, 466.0] | [613, 181, 595] |
p02689 | u531456543 | 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())\nilst = [int(i) for i in input().split()]\ntlst = [0]*n\ntotal = 0\nfor i in range(m):\n List = [int(j) for j in input().split()]\n print(List)\n xlst = []\n for p in List:\n xlst.append(ilst[p-1])\n print(xlst)\n maxIndex = [i for i, x in enumerate(xlst) if x == max(xlst)]\n print(maxIndex)\n if len(maxIndex) >= 2:\n for k in List:\n tlst[k-1] +=1\n else:\n List.pop(maxIndex[0])\n for k in List:\n tlst[k-1] +=1\nfor x in tlst:\n if x == 0:\n total +=1\nprint(total)', 'n,m=map(int,input().split())\nilst = [int(i) for i in input().split()]\ntlst = [0]*n\ntotal = 0\nfor i in range(m):\n List = [int(j) for j in input().split()]\n xlst = []\n for p in List:\n xlst.append(ilst[p-1])\n maxIndex = [i for i, x in enumerate(xlst) if x == max(xlst)]\n if len(maxIndex) >= 2:\n for k in List:\n tlst[k-1] +=1\n else:\n List.pop(maxIndex[0])\n for k in List:\n tlst[k-1] +=1\nfor x in tlst:\n if x == 0:\n total +=1\nprint(total)'] | ['Wrong Answer', 'Accepted'] | ['s495748580', 's857729700'] | [20164.0, 20140.0] | [790.0, 358.0] | [563, 511] |
p02689 | u531599639 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ["N, M = map(int, input().split())\nheight = [int(i) for i in input().split()]\nroads = [list(map(int, input().split())) for _ in range(N)]\nalone=[]\nans={}\nb_list=[]\nfor i in range(1, N+1):\n alone.append(i)\nfor road in roads:\n if max(road) not in b_list:\n ans[max(road)]='Yes'\n b_list.append(min(road))\n elif road[0] in alone:\n alone.remove(road[0])\n elif road[1] in alone:\n alone.remove(road[1])\nprint(len(ans)+len(alone))", "N, M = map(int, input().split())\nheight = [int(i) for i in input().split()]\nroads = [list(map(int, input().split())) for _ in range(M)]\nalone=[]\nans={}\nb_list=[]\nfor i in range(1, N+1):\n alone.append(i)\nfor road in roads:\n if max(road) not in b_list:\n ans[max(road)]='Yes'\n b_list.append(min(road))\n elif road[0] in alone:\n alone.remove(road[0])\n elif road[1] in alone:\n alone.remove(road[1])\nprint(len(ans)+len(alone))\n", 'N,M = map(int, input().split())\nH = [0] + list(map(int, input().split()))\nP = [0] + [1]*N\nfor i in range(M):\n A,B = map(int, input().split())\n if H[A]<=H[B]:\n P[A]=0\n if H[A]>=H[B]:\n P[B]=0\nprint(sum(P))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s005127076', 's969230781', 's189859893'] | [36320.0, 36288.0, 20016.0] | [2206.0, 2206.0, 252.0] | [435, 436, 212] |
p02689 | u532966492 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['def main():\n n, m = map(int, input().split())\n wxyz = [list(map(int, input().split())) for _ in [0]*m]\n\n class unionfind():\n \n def __init__(self, size): \n self.size = size\n self.tree_root = list(range(self.size))\n self.tree_depth = [1]*self.size\n\n \n def root(self, index):\n temp_list = []\n temp = self.tree_root[index]\n while index != temp:\n temp_list.append(index)\n index = temp\n temp = self.tree_root[index]\n for i in temp_list:\n self.tree_root[i] = index\n return index\n\n \n def unite(self, index1, index2):\n r1 = self.root(index1)\n r2 = self.root(index2)\n if r1 != r2:\n d1, d2 = self.tree_depth[r1], self.tree_depth[r2]\n if d1 <= d2:\n self.tree_root[r1] = r2\n self.tree_depth[r2] = max(d1+1, d2)\n else:\n self.tree_root[r2] = r1\n self.tree_depth[r1] = max(d2+1, d1)\n\n \n def same(self, index1, index2):\n r1 = self.root(index1)\n r2 = self.root(index2)\n return r1 == r2\n\n \n def component(self):\n return len({self.root(i) for i in range(self.size)})\n\n u = unionfind(2*n)\n\n for w, x, y, z in wxyz:\n x -= 1\n y -= 1\n if w == 1:\n if z % 2 == 0:\n u.unite(x, y)\n u.unite(x+n, y+n)\n else:\n u.unite(x, y+n)\n u.unite(x+n, y)\n else:\n print(["NO", "YES"][u.same(x, y) or u.same(x+n, y+n)])\n\n\nmain()\n', 'def main():\n n, m = map(int, input().split())\n h = list(map(int, input().split()))\n ab = [list(map(int, input().split())) for _ in [0]*m]\n g = [[] for _ in [0]*n]\n [g[a-1].append(b-1) for a, b in ab]\n [g[b-1].append(a-1) for a, b in ab]\n\n cnt = 0\n for i in range(n):\n hh = h[i]\n for j in g[i]:\n if h[j] >= hh:\n break\n else:\n cnt += 1\n print(cnt)\n\n\nmain()\n'] | ['Runtime Error', 'Accepted'] | ['s952480898', 's786063809'] | [41432.0, 49080.0] | [245.0, 384.0] | [1853, 440] |
p02689 | u534308356 | 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 = list(map(int, input().split()))\ndata = []\nfor _ in range(m):\n data.append( list(map(int, input().split())) )\n\nans_list = [1 for _ in range(n)]\n\nfor d in data:\n \n d_0 = d[0] - 1\n d_1 = d[1] - 1\n\n if h_list[d_0] == h_list[d_1]:\n ans_list[d_0] = 0\n ans_list[d_1] = 0\n\n if h_list[d_0] > h_list[d_1]:\n ans_list[d_1] = 0\n\n if h_list[d_1] > h_list[d_0]:\n ans_list[d_0] = 0\n\nprint(*ans_list)\nprint(ans_list.count(1))\n', '\nn, m = map(int, input().split())\nh_list = list(map(int, input().split()))\ndata = []\nfor _ in range(m):\n data.append( list(map(int, input().split())) )\n\nans_list = [1 for _ in range(n)]\n\nfor d in data:\n \n d_0 = d[0] - 1\n d_1 = d[1] - 1\n\n if h_list[d_0] == h_list[d_1]:\n ans_list[d_0] = 0\n ans_list[d_1] = 0\n\n if h_list[d_0] > h_list[d_1]:\n ans_list[d_1] = 0\n\n if h_list[d_1] > h_list[d_0]:\n ans_list[d_0] = 0\n\n# print(*ans_list)\nprint(ans_list.count(1))\n'] | ['Wrong Answer', 'Accepted'] | ['s514007002', 's906343403'] | [33008.0, 31932.0] | [345.0, 331.0] | [526, 528] |
p02689 | u536034761 | 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(" "))\nflag = [1 for i in range(M)]\nheight = list(map(int, input().split(" ")))\nfor i in range(M):\n a, b = map(int, input().split(" "))\n if height[a - 1] < height[b - 1]:\n flag[a - 1] = 0\n elif height[a - 1] > height[b - 1]:\n flag[b - 1] = 0\n else:\n flag[a - 1] = 0\n flag[b - 1] = 0\nprint(sum(flag))', 'N, M = map(int, input().split(" "))\nflag = [1 for i in range(M)]\nheight = list(map(int, input().split(" ")))\nfor i in range(M):\n a, b = map(int, input().split(" "))\n if height[a - 1] < height[b - 1]:\n flag[a - 1] = 0\n elif height[a - 1] > height[b - 1]:\n flag[b - 1] = 0\n else:\n flag[a - 1] = flag[b - 1] = 0\nprint(sum(flag))', 'N, M = map(int, input().split(" "))\nheight = map(int, input().split(" "))\nflag = [1 for i in renge(len(height))]\nfor i in range(M):\n a, b = map(int, input().split(" "))\n if height[a - 1] > height[b - 1]:\n flag[b - 1] = 0\n elif height[b - 1] > height[a - 1]:\n flag[a - 1] = 0\nprint(sum(flag))', 'N, M = map(int, input().split(" "))\nflag = [1 for i in range(N)]\nheight = list(map(int, input().split(" ")))\nfor i in range(M):\n a, b = map(int, input().split(" "))\n if height[a - 1] < height[b - 1]:\n flag[a - 1] = 0\n elif height[a - 1] > height[b - 1]:\n flag[b - 1] = 0\n else:\n flag[a - 1] = 0\n flag[b - 1] = 0\nprint(sum(flag))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s175341571', 's385317253', 's476352702', 's512932518'] | [20764.0, 20756.0, 17100.0, 20800.0] | [255.0, 260.0, 33.0, 252.0] | [344, 338, 300, 344] |
p02689 | u538817603 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ["import sys\ninput = sys.stdin.readline\n\ndef main():\n N, M = map(int, input().split())\n V = [True] * N\n H = [int(v) for v in input().split()]\n AB = [[map(int, input().split())] for _ in range(M)]\n for ab in AB:\n a, b = ab\n a-=1\n b-=1\n # if V[a] or V[b]:\n if H[a] < H[b]:\n V[a] = False\n else:\n V[b] = False\n \n print(V.count(True))\n\nif __name__ == '__main__':\n main()", "import sys\ninput = sys.stdin.readline\n\ndef main():\n N, M = map(int, input().split())\n V = [True] * N\n H = [int(v) for v in input().split()]\n AB = [[int(v) - 1 for v in input().split()] for _ in range(M)]\n for a, b in AB:\n if V[a] or V[b]:\n if H[a] <= H[b]:\n V[a] = False\n if H[a] >= H[b]:\n V[b] = False\n \n print(V.count(True))\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s234876689', 's324926158'] | [65724.0, 30340.0] | [346.0, 171.0] | [451, 445] |
p02689 | u539969758 | 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()))\nmichi = [[] for i in range(N)]\n \nfor i in range(M):\n a,b = map(int,input().split())\n michi[a-1].append(b-1)\n michi[b-1].append(a-1)\n\n \nans = 0\nfor i in range(N): \n if michi[i] == []:\n print(i)\n ans +=1\n else:\n for j in michi[i]:\n # print(i,j,H[i],H[j]) \n \n if H[i] <= H[j]:\n \n break\n if j == michi[i][-1]:\n ans += 1\n print(i)\n \nprint(ans)', 'N, M = map(int,input().split())\nH = list(map(int,input().split()))\nmichi = [[] for i in range(N)]\n \nfor i in range(M):\n a,b = map(int,input().split())\n michi[a-1].append(b-1)\n michi[b-1].append(a-1)\n\n \nans = 0\nfor i in range(N): \n if michi[i] == []:\n ans +=1\n else:\n counter = 0\n \n for j in michi[i]:\n counter += 1\n \n # print(i,j,H[i],H[j]) \n \n if H[i] <= H[j]:\n \n break\n if counter == len(michi[i]):\n \n ans += 1\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s223281663', 's134512444'] | [29632.0, 29436.0] | [381.0, 370.0] | [612, 754] |
p02689 | u542190960 | 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 math\n\nx = int(input())\n\nend = math.floor(x**0.2)\n\nfor i in range(1, x+1):\n if x % i == 0:\n for a in range(i//2,end,1):\n b = a - i\n if a**5 - b**5 == x:\n print(a, b)\n break', 'n, m = map(int, input().split())\n \nh_list = list(map(int,input().split()))\n \nway_list = []\nfor i in range(m):\n org = list(map(int, input().split()))\n org.sort()\n way_list.append(org)\n \nbad = []\n \nfor j in range(m):\n way = way_list[j]\n if h_list[way[0]-1] > h_list[way[1]-1]:\n bad.append(way[1])\n elif h_list[way[0]-1] < h_list[way[1]-1]:\n bad.append(way[0])\n else:\n bad.append(way[0])\n bad.append(way[1])\n \nbad = list(set(bad))\nprint(n - len(bad))'] | ['Runtime Error', 'Accepted'] | ['s778179990', 's728251740'] | [9196.0, 34584.0] | [27.0, 330.0] | [240, 496] |
p02689 | u543000780 | 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()))\nadj_max = [0]*N\nans = 0\nfor _ in range(M):\n tmp1, tmp2 = map(int, input().split())\n adj_max[tmp1] = max(adj_max[tmp1], H[tmp2])\n adj_max[tmp2] = max(adj_max[tmp2], H[tmp1])\nfor num in range(N):\n if H[num] > adj_max[num]:\n ans += 1\nprint(ans)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nadj_max = [0]*N\nans = 0\nfor _ in range(M):\n tmp1, tmp2 = map(int, input().split())\n adj_max[tmp1-1] = max(adj_max[tmp1-1], H[tmp2-1])\n adj_max[tmp2-1] = max(adj_max[tmp2-1], H[tmp1-1])\nfor num in range(N):\n if H[num] > adj_max[num]:\n ans += 1\nprint(ans)\n\n'] | ['Runtime Error', 'Accepted'] | ['s048110741', 's538852957'] | [20124.0, 20120.0] | [308.0, 328.0] | [317, 331] |
p02689 | u547375079 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['N, M = map(int, input().split())\nheights = list(map(int, input().split()))\n \ngood = [True] * N\nfor m in range(0, M):\n A, B = map(int, input().split())\n if heights[A] > heights[B]:\n good[B] = False\n elif heights[A] < heights[B]:\n good[A] = False\n \ncount = 0\nfor obs in good:\n if obs: count += 1\n \nprint(count)\n', 'N, M = map(int, input.split())\nheights = list(map(int, input.split()))\n\ngood = [True] * N\nfor m in range(0, M):\n A, B = map(int, input.split())\n if A > B:\n good[B] = False\n elif A < B:\n good[A] = False\n \ncount = 0\nfor obs in good:\n if obs: count++\n \nprint(count)', 'N, M = map(int, input().split())\nheights = list(map(int, input().split()))\n \ngood = [True] * N\nfor m in range(0, M):\n A, B = [int(s)-1 for s in input.split()]\n if heights[A] >= heights[B]:\n good[B] = False\n elif heights[A] <= heights[B]:\n good[A] = False\n \ncount = 0\nfor obs in good:\n if obs: count += 1\n \nprint(count)', 'N, M = map(int, input().split())\nheights = list(map(int, input().split()))\n \ngreatest = [0] * N\nfor m in range(0, M):\n A, B = [int(s)-1 for s in input().split()]\n greatest[A] = max(greatest[A], heights[B])\n greatest[B] = max(greatest[B], heights[A])\n \ncount = 0\nfor i in range(0, N):\n count += heights[i] > greatest[i]\n \nprint(count)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s166667294', 's256997200', 's602769784', 's070654954'] | [20028.0, 8984.0, 20152.0, 20112.0] | [241.0, 22.0, 46.0, 325.0] | [325, 278, 334, 346] |
p02689 | u548545174 | 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\nneighbor_max_heights = [0] * N\n\nfor i in range(M):\n a, b = AB[i]\n neighbor_max_heights[b-1] = max(neighbor_max_heights[b-1], H[a-1])\n neighbor_max_heights[a-1] = max(neighbor_max_heights[a-1], H[b-1])\n\nans = 0\nfor j in range(N):\n if H[j-1] > neighbor_max_heights[j-1]:\n ans += 1\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\nneighbor_max_heights = [0] * N\n\nfor i in range(M):\n a, b = AB[i]\n neighbor_max_heights[b-1] = max(neighbor_max_heights[b-1], H[a-1])\n neighbor_max_heights[a-1] = max(neighbor_max_heights[a-1], H[b-1])\n\nans = 0\nfor j in range(N):\n if H[j-1] > neighbor_max_heights[j-1]:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s051066438', 's256759603'] | [10864.0, 32032.0] | [23.0, 388.0] | [431, 435] |
p02689 | u549494450 | 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(" ")\nh = input().split(" ")\nc = {}\nfor j in range(int(a[0])):\n c[str(j+1)] = [int(h[j]),"good"]\nb = []\ngood = int(a[0])\nfor i in range(int(a[1])):\n d = input().split()\n x = int(c[d[0]][0])\n y = int(c[d[1]][0])\n if x > y:\n c[d[1]][1] = "bad"\n if y > x:\n c[d[0]][1] = "bad"\n if y == x:\n c[d[1]][1] = "bad"\n c[d[0]][1] = "bad"\nkotae = 0\nfor k in range(int(a[0])):\n if c[str(k+1)][1] == "good":\n kotae += 1\nprint(c)\nprint(kotae)', 'a = input().split(" ")\nh = input().split(" ")\nc = {}\nfor j in range(int(a[0])):\n c[str(j+1)] = [int(h[j]),"good"]\nb = []\ngood = int(a[0])\nfor i in range(int(a[1])):\n d = input().split()\n x = int(c[d[0]][0])\n y = int(c[d[1]][0])\n if x > y:\n c[d[1]][1] = "bad"\n if y > x:\n c[d[0]][1] = "bad"\n if y == x:\n c[d[1]][1] = "bad"\n c[d[0]][1] = "bad"\nkotae = 0\nfor k in range(int(a[0])):\n if c[str(k+1)][1] == "good":\n kotae += 1\nprint(kotae)'] | ['Wrong Answer', 'Accepted'] | ['s206412416', 's265407758'] | [47480.0, 40612.0] | [520.0, 459.0] | [501, 492] |
p02689 | u551437236 | 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\nmin = []\nfor i in range(m):\n a, b = map(int, input().split())\n if h[a] < h[b]:\n min.append(a)\n if h[a] == h[b]:\n min.append(a)\n min.append(b)\n if h[a] > h[b]:\n min.append(b)\n\nprint(len(h)-len(set(min)))\n', 'n, m = map(int, input().split())\nh = list(map(int,input().split()))\n\nmin = []\nfor i in range(m):\n a, b = map(int, input().split())\n if h[a-1] < h[b-1]:\n min.append(a)\n if h[a-1] == h[b-1]:\n min.append(a)\n min.append(b)\n if h[a-1] > h[b-1]:\n min.append(b)\n\nprint(len(h)-len(set(min)))\n'] | ['Runtime Error', 'Accepted'] | ['s134135886', 's281548274'] | [20116.0, 20112.0] | [245.0, 281.0] | [312, 324] |
p02689 | u552533086 | 2,000 | 1,048,576 | There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road. How many good observatories are there? | ['N, K = map(int, input().split())\nheight = list(map(int, input().split()))\nroad = {}\n\n\nfor i in range(K):\n a, b = list(map(int, input().split()))\n try:\n road[a-1].append(b-1)\n except:\n road[a-1] = [b-1]\n try:\n road[b-1].append(a-1)\n except:\n road[b-1] = [a-1]\n\ncnt = 0\nfor k, v in road.items():\n flag = True\n for i in set(v):\n if height[k] > height[i]:\n pass\n else:\n flag = False\n if flag is True:\n cnt += 1\nprint(cnt+(n-len(d.keys())))', 'N, K = map(int, input().split())\nheight = list(map(int, input().split()))\nroad = {}\n\n\nfor i in range(K):\n a, b = list(map(int, input().split()))\n try:\n road[a-1].append(b-1)\n except:\n road[a-1] = [b-1]\n try:\n road[b-1].append(a-1)\n except:\n road[b-1] = [a-1]\n\ncnt = 0\nfor k, v in road.items():\n flag = True\n for i in set(v):\n if height[k] > height[i]:\n pass\n else:\n flag = False\n if flag is True:\n cnt += 1\nprint(cnt+(N-len(road.keys())))'] | ['Runtime Error', 'Accepted'] | ['s003909606', 's860420228'] | [34460.0, 34776.0] | [477.0, 453.0] | [550, 553] |
p02689 | u552741877 | 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_a = list(map(int, input().split()))\n\nm_l = [[0,0]]*m\nr_l = [{}]*n\nfor i in range(m):\n r = list(map(int, input().split()))\n a = r[0] - 1\n b = r[1] - 1\n\n ral = set([]) if len(r_l[a]) == 0 else r_l[a]\n rbl = set([]) if len(r_l[b]) == 0 else r_l[b]\n\n ral.add(b)\n rbl.add(a)\n\n r_l[a] = ral\n r_l[b] = rbl\nprint(r_l)\n\ncnt = 0\nfor ni in range(n):\n for r in r_l[ni]:\n if h_a[r] >= h_a[ni]:\n break\n else:\n cnt+=1\n\nprint(cnt)', 'n,m = map(int, input().split())\nh_a = list(map(int, input().split()))\n\nm_l = [[0,0]]*m\nr_l = [{}]*n\nfor i in range(m):\n r = list(map(int, input().split()))\n a = r[0] - 1\n b = r[1] - 1\n\n ral = set([]) if len(r_l[a]) == 0 else r_l[a]\n rbl = set([]) if len(r_l[b]) == 0 else r_l[b]\n\n ral.add(b)\n rbl.add(a)\n\n r_l[a] = ral\n r_l[b] = rbl\n\ncnt = 0\nfor ni in range(n):\n for r in r_l[ni]:\n if h_a[r] >= h_a[ni]:\n break\n else:\n cnt+=1\n\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s155962355', 's912394538'] | [46952.0, 43088.0] | [563.0, 505.0] | [470, 459] |
p02689 | u557750361 | 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 H = list(map(int, input().split()))\n LIST = [ 1 for _ in range(N)]\n for _ in range(M):\n A, B = map(int, input().split())\n if H[A-1] >= H[B-1]: LIST[B-1] = 0\n if H[A-1] <= H[B-1]: LIST[A-1] = 0\n print(sum(LIST))\n', 'n, m = map(int, input().split())\n\nh = list(map(int, input().split()))\n\nans = []\n\nfor i in range(m):\n a, b = map(int, input().split())\n if h[a-1] < h[b-1]:\n ans.append(a)\n elif h[b-1] < h[a-1]:\n ans.append(b)\n elif h[a-1] == h[b-1]:\n ans.append(a)\n ans.append(b)\nx = set(ans)\n\nprint(n-len(x))\n'] | ['Runtime Error', 'Accepted'] | ['s672131723', 's124098222'] | [8952.0, 20112.0] | [20.0, 259.0] | [282, 332] |
p02689 | u558242240 | 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? | ['class UnionFind:\n def __init__(self, n):\n self.root = list(range(n))\n self.size = [1] * (n)\n self.maxh = [0] * (n)\n def find_root(self, x):\n root = self.root\n while root[x] != x:\n root[x] = root[root[x]]\n x = root[x]\n return x\n\n def merge(self, x, y):\n x = self.find_root(x)\n y = self.find_root(y)\n if x == y:\n return\n sx,sy = self.size[x],self.size[y]\n if sx < sy:\n self.root[x] = y\n self.size[y] += sx\n self.maxh[y] = max(h[x], h[y])\n else:\n self.root[y] = x\n self.size[x] += sy\n self.maxh[y] = max(h[x], h[y])\n\nn, m = map(int, input().split())\nh = list(map(int , input().split()))\n\nuf = UnionFind(n)\nfor _ in range(m):\n a, b = map(int, input().split())\n uf.merge(a-1, b-1)\n\n#print(h)\n\n\nmaxh = [0] * n\nfor i in range(n):\n maxh[uf.find_root(i)] = max(maxh[uf.find_root(i)], h[i])\n \n#print(maxh)\nans = 0\nfor i in range(n):\n if maxh[uf.find_root(i)] == h[i]:\n ans += 1\n\nprint(ans)', 'n, m = map(int, input().split())\nh = list(map(int , input().split()))\n\nG = [[] for _ in range(n)]\nfor _ in range(m):\n a, b = map(int, input().split())\n G[a-1].append(b-1)\n G[b-1].append(a-1)\n#print(G)\nans = 0\nfor i in range(n):\n maxh = 0\n for gi in G[i]:\n maxh = max(h[gi], maxh)\n if maxh < h[i]:\n ans += 1\n #print(maxh, h[i])\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s609076417', 's068611165'] | [20208.0, 29436.0] | [441.0, 406.0] | [1181, 374] |
p02689 | u561862393 | 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\nimport numpy as np\n\nn, m = map(int, input().split())\n\nT_Height = [int(h) for h in input().split()]\n\nRoads = [[0] * n for _ in range(n)]\n\nfor i in range(m):\n a, b = map(int, input().split())\n Roads[a-1][b-1] = T_Height[b-1]\n Roads[b-1][a-1] = T_Height[a-1]\n\n\ni = 0\nans = 0\nfor E in Roads:\n print(max(E), T_Height[i])\n if T_Height[i] > max(E):\n ans += 1\n i+=1\n\nprint(ans)\n', 'import sys\ninput = sys.stdin.readline\nimport numpy as np\n\nn, m = map(int, input().split())\n\nT_Height = [int(h) for h in input().split()]\n\nRoads = [0] * n\n\nfor i in range(m):\n a, b = map(int, input().split())\n b_h = T_Height[b-1]\n a_h = T_Height[a-1]\n if b_h > Roads[a-1]:\n Roads[a-1] = b_h\n if a_h > Roads[b-1]:\n Roads[b-1] = a_h\n\n\ni = 0\nans = 0\nfor e in Roads:\n if T_Height[i] > e:\n ans += 1\n i+=1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s712498668', 's423927144'] | [2157876.0, 38664.0] | [2266.0, 273.0] | [433, 453] |
p02689 | u562400059 | 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()))\n\nAB = [[]] * N\n\nfor i in range(M):\n A, B = list(map(int, input().split()))\n tmp = copy.deepcopy(AB[A-1])\n tmp.append(B-1)\n AB[A-1] = tmp\n tmp = copy.deepcopy(AB[B-1])\n tmp.append(A-1)\n AB[B-1] = tmp\n\nprint(AB)\ncnt = 0\nfor j in range(len(AB)):\n for val in set(AB[j]):\n if H[j] <= H[val]:\n break\n else:\n cnt += 1\n\nprint(cnt)\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\n\nresult = [1] * N\n\nfor i in range(M):\n A, B = list(map(int, input().split()))\n if H[A-1] <= H[B-1]:\n result[A-1] = 0\n if H[B-1] <= H[A-1]:\n result[B-1] = 0\n\nprint(sum(result))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s864846127', 's748223084'] | [32548.0, 20112.0] | [2206.0, 279.0] | [457, 269] |
p02689 | u563838154 | 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(map(int,input().split())) for j in range(m)]\n# print("h:",h)\n# print("a",a)\ncan_go = [[] for i in range(n)]\n# print(can_go)\nfor i in a:\n # print(i)\n can_go[i[0]-1].append(i[1])\n can_go[i[1]-1].append(i[0])\n# print(can_go)\nb = 0\nans=0\nfor i,j in enumerate(can_go):\n # for j in can_go:\n b= 0\n\n for k in j:\n print( h[k-1]-h[i])\n if h[k-1]>=h[i]:\n b=1\n # print("break")\n break\n if b==1:\n b=0\n else:\n ans+=1\nprint(ans)\n \n\n', 'n,m=map(int,input().split())\nh = list(map(int,input().split()))\na = [list(map(int,input().split())) for j in range(m)]\n# print("h:",h)\n# print("a",a)\ncan_go = [[] for i in range(n)]\n# print(can_go)\nfor i in a:\n # print(i)\n can_go[i[0]-1].append(i[1])\n can_go[i[1]-1].append(i[0])\n# print(can_go)\nb = 0\nans=0\nfor i,j in enumerate(can_go):\n # for j in can_go:\n b= 0\n\n for k in j:\n # print( h[k-1]-h[i])\n if h[k-1]>=h[i]:\n b=1\n # print("break")\n break\n if b==1:\n b=0\n else:\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s041591592', 's369484813'] | [41336.0, 41248.0] | [435.0, 449.0] | [579, 574] |
p02689 | u567430603 | 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()))\nng_peaks = set([])\nfor j in range(M):\n A_j, B_j = map(int, input().split())\n if peaks[A_j-1] >= peaks[B_j-1]:\n ng_peaks.add(B_j)\n if peaks[A_j-1] =< peaks[B_j-1]:\n ng_peaks.add(A_j)\nprint(N-len(ng_peaks))', 'N, M = map(int, input().split())\npeaks = list(map(int, input().split()))\nng_peaks = set([])\nfor j in range(M):\n A_j, B_j = map(int, input().split())\n if peaks[A_j-1] >= peaks[B_j-1]:\n ng_peaks.add(B_j)\n if peaks[A_j-1] <= peaks[B_j-1]:\n ng_peaks.add(A_j)\nprint(N-len(ng_peaks))'] | ['Runtime Error', 'Accepted'] | ['s728304979', 's511420071'] | [9040.0, 20100.0] | [22.0, 278.0] | [300, 300] |
p02689 | u568559987 | 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(map(int,input().split()))\nx=[[] for _ in range(n+1)]\nfor i in range(m):\n a,b=map(int,input().split())\n x[a].append(h[b-1])\n x[b].append(h[a-1])\ncount=0\nfor j in range(1,n+1):\n if x[j]==[]:\n count+=1\n else:\n if h[j-1]>max(x[j]):\n count+=1\nprint(count)\n ', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\nx=[[] for _ in range(n+1)]\nfor i in range(m):\n a,b=map(int,input().split())\n x[a].append(h[b-1])\n x[b].append(h[a-1])\ncount=0\nfor j in range(1,n+1):\n if x[j]==[]:\n count+=1\n else:\n if h[j-1]>max(x[j]):\n count+=1\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s003086174', 's712020725'] | [9152.0, 22840.0] | [28.0, 366.0] | [276, 302] |
p02689 | u570155187 | 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\ng = [[] for _ in range(n)]\nfor _ in range(m):\n a,b = map(int,input().split())\n g[a-1].append(b-1)\n g[b-1].append(a-1)\nprint(g)\n\ncnt = n\nfor i in range(n):\n for j in g[i]:\n if h[i] <= h[j]:\n cnt -= 1\n break\nprint(cnt)', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\n\ng = [[] for _ in range(n)]\nfor _ in range(m):\n a,b = map(int,input().split())\n g[a-1].append(b-1)\n g[b-1].append(a-1)\n\ncnt = n\nfor i in range(n):\n for j in g[i]:\n if h[i] <= h[j]:\n cnt -= 1\n break\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s272980515', 's708418112'] | [33348.0, 29316.0] | [388.0, 379.0] | [300, 291] |
p02689 | u580273604 | 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? | ['4 3\n1 2 3 4\n1 3\n2 3\n2 4', 'N,M=map(int,input().split())\nH=list(map(int,input().split()))\nA=[0]*M;B=[0]*M\nC=[0]*N\nfor i in range(M):\n A[i],B[i]=map(int,input().split())\n\nfor i in range(M):\n if H[A[i]-1]<H[B[i]-1]:C[A[i]-1]+=1\n elif H[A[i]-1]>H[B[i]-1]:C[B[i]-1]+=1\n else:C[A[i]-1]+=1;C[B[i]-1]+=1\nprint(C.count(0))'] | ['Runtime Error', 'Accepted'] | ['s734405360', 's966009739'] | [8900.0, 21764.0] | [24.0, 273.0] | [23, 290] |
p02689 | u586639900 | 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()))\nconditions = [[] for _ in range(N)]\nfor i in range(M):\n a, b = map(int, input().split())\n \n \n conditions[a - 1].append(b - 1)\n conditions[b - 1].append(a - 1)\n\nbad_count = [1] * N\nfor i, cond in enumerate(conditions):\n for j in cond:\n if H[i] <= H[j]: # bimyou\n bad_count[i] = 0\n print(f'{i} is bad')\n\nprint(N - sum(bad_count))", "N, M = map(int, input().split())\nH = list(map(int, input().split()))\nconditions = [[] for _ in range(N)]\nfor i in range(M):\n a, b = map(int, input().split())\n \n \n conditions[a - 1].append(b - 1)\n conditions[b - 1].append(a - 1)\n\nbad_count = [1] * N\nfor i, cond in enumerate(conditions):\n for j in cond:\n if H[i] < H[j]: # bimyou\n bad_count[i] = 0\n print(f'{i} is bad')\n\nprint(N - sum(bad_count))", 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nrecord = [1] * N\nfor i in range(M):\n a, b = map(int, input().split())\n if H[a - 1] <= H[b - 1]:\n record[a - 1] = 0\n if H[a - 1] >= H[b - 1]:\n record[b - 1] = 0\n\nprint(sum(record))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s450749896', 's749204843', 's684568637'] | [30156.0, 30184.0, 19980.0] | [428.0, 421.0, 260.0] | [599, 598, 271] |
p02689 | u586662847 | 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\n\ndef resolve():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n\n A = np.zeros((N, N))\n for i in range(M):\n pp, ss = map(int, input().split())\n ss -= 1\n pp -= 1\n A[pp][ss] = H[ss]\n A[ss][pp] = H[pp]\n\n ans = 0\n\n\nresolve()\n', 'import numpy as np\n\n\ndef resolve():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n\n A = np.zeros((N, N), dtype=int)\n for i in range(M):\n pp, ss = map(int, input().split())\n ss -= 1\n pp -= 1\n A[pp][ss] = H[ss]\n A[ss][pp] = H[pp]\n\n ans = 0\n for j in range(N):\n if (A[j].max() == 0 or H[j] > A[j].max()):\n ans += 1\n\n print(A)\n\n\nresolve()', 'def resolve():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n\n A = [[] for _ in range(N)]\n for i in range(M):\n pp, ss = map(int, input().split())\n ss -= 1\n pp -= 1\n A[pp].append(H[ss])\n A[ss].append(H[pp])\n\n ans = 0\n for j in range(N):\n now = H[j]\n if not A[j] or now > max(A[j]):\n ans += 1\n\n print(ans)\n\n\nresolve()'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s338192476', 's799877414', 's607437928'] | [38532.0, 38468.0, 22988.0] | [132.0, 127.0, 321.0] | [314, 433, 421] |
p02689 | u589047182 | 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())\nans_list = list(range(1,N))\nHList = list(map(int, input().split()))\nrootList = []\n\nfor i in range(M):\n a, b = map(int, input().split())\n H_a = HList[a-1]\n H_b = HList[b-1]\n if(a in ans_list):\n if(H_b > H_a or H_b == H_a):\n ans_list.remove(a)\n if(b in ans_list):\n if(H_a > H_b or H_b == H_a):\n ans_list.remove(b)\n\nprint(len(ans_list))\n', 'N, M = map(int, input().split())\nkeyList = list(range(1,N+1))\nvalues = [True] * N\ndic = dict(zip(keyList, values))\nHList = list(map(int, input().split()))\nans = []\n\nfor i in range(M):\n a, b = map(int, input().split())\n H_a = HList[a-1]\n H_b = HList[b-1]\n if(H_a == H_b):\n dic[a] = False\n dic[b] = False\n elif(H_b > H_a):\n dic[a] = False\n elif(H_a > H_b):\n dic[b] = False\n\n\nfor i in range(1, len(dic.values())+1):\n if(dic[i] == True):\n ans.append(dic[i])\nprint(len(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s236475065', 's126946089'] | [24280.0, 30112.0] | [2206.0, 322.0] | [388, 492] |
p02689 | u591734860 | 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 make_heights_list(height):\n return [height, True]\n\n\ntower_len, roads_len = map(int, input().split(' '))\n\nheights = [[0, False]]\nheights += (list(map(make_heights_list, input().split(' '))))\n\nprint(heights)\n\n\nroads_highest = list()\nfor i in range(roads_len):\n start, end = map(int, input().split(' '))\n print(start, end)\n if heights[start][1] is True and heights[end][0] >= heights[start][0]:\n heights[start][1] = False\n \n if heights[end][1] is True and heights[start][0] >= heights[end][0]:\n heights[end][1] = False\n \n\ngood_towers_len = 0\nfor tower in heights:\n if tower[1]:\n good_towers_len += 1\n\nprint(good_towers_len)\n", "def make_heights_list(height):\n return [int(height), True]\n\n\ntower_len, roads_len = map(int, input().split(' '))\n\nheights = [[0, False]]\nheights += (list(map(make_heights_list, input().split(' '))))\n\n#print(heights)\n\n\nroads_highest = list()\nfor i in range(roads_len):\n start, end = map(int, input().split(' '))\n #print(start, end)\n if heights[start][1] is True and heights[end][0] >= heights[start][0]:\n heights[start][1] = False\n \n if heights[end][1] is True and heights[start][0] >= heights[end][0]:\n heights[end][1] = False\n \n\ngood_towers_len = 0\nfor tower in heights:\n if tower[1]:\n good_towers_len += 1\n\nprint(heights)\n\nprint(good_towers_len)\n", "def make_heights_list(height):\n return [int(height), True]\n\n\ntower_len, roads_len = map(int, input().split(' '))\n\nheights = [[0, False]]\nheights += (list(map(make_heights_list, input().split(' '))))\n\n#print(heights)\n\n\nroads_highest = list()\nfor i in range(roads_len):\n start, end = map(int, input().split(' '))\n #print(start, end)\n if heights[start][1] is True and heights[end][0] >= heights[start][0]:\n heights[start][1] = False\n \n if heights[end][1] is True and heights[start][0] >= heights[end][0]:\n heights[end][1] = False\n \n\ngood_towers_len = 0\nfor tower in heights:\n if tower[1]:\n good_towers_len += 1\n\n#print(heights)\n\nprint(good_towers_len)\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s097173712', 's951341834', 's993986785'] | [30364.0, 28044.0, 27940.0] | [596.0, 349.0, 320.0] | [787, 810, 811] |
p02689 | u592601397 | 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? | ['#ABC166\nN,M=map(int,input().split())\nH =list(map(int,input().split())) \nA = list(range(N))\nfor i in range(M):\n a, b = map(int, input().split())\n if H[a-1] > H[b-1]:\n A[b-1] = 0\n elif H[a-1] < H[b-1]:\n A[a-1] = 0\n else:\n A[a-1] = 0 and A[b-1] = 0\n\nprint(N-A.count(0))', '#ABC166\nN,M=map(int,input().split())\nH =list(map(int,input().split())) \nA = list(range(1,N+1))\nfor i in range(M):\n a, b = map(int, input().split())\n if H[a-1] > H[b-1]:\n A[b-1] = 0\n elif H[a-1] < H[b-1]:\n A[a-1] = 0\n else:\n A[a-1] = 0\n A[b-1] = 0\nprint(N-A.count(0))'] | ['Runtime Error', 'Accepted'] | ['s593407019', 's888492630'] | [9132.0, 20076.0] | [31.0, 257.0] | [319, 326] |
p02689 | u594956556 | 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\ngooddict={i:1 for i in 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 gooddict[a]=0\n if h[a-1]>=h[b-1]:\n gooddict[b]=0\n\ncount=0\nfor i in range(1,n+1):\n if gooddict[i]==1:\n count+=1\nprint(count)\nprint(gooddict)', 'n,m=map(int,input().split())\nh=list(map(int,input().split()))\n\ngooddict={i:1 for i in 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 gooddict[a]=0\n if h[a-1]>=h[b-1]:\n gooddict[b]=0\n\ncount=0\nfor i in range(1,n+1):\n if gooddict[i]==1:\n count+=1\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s132345903', 's102272481'] | [24592.0, 24544.0] | [323.0, 333.0] | [325, 309] |
p02689 | u595375942 | 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 = dict()\nfor i in range(1, N+1):\n G[i] = [0]\n\nfor _ in range(M):\n A, B = map(int, input().split())\n G[A] += [B]\n G[B] += [A]\n\ncnt = 0\nfor i in range(1, N+1):\n flag = False\n if len(G[i]) > 1:\n for j in G[i]:\n if H[i-1] <= H[j-1]:\n flag = False\n break\n else:\n flag = True\n else:\n flag = True\n if flag:\n cnt += 1\n\nprint(cnt)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nG = dict()\nfor i in range(1, N+1):\n G[i] = [0]\n\nfor _ in range(M):\n A, B = map(int, input().split())\n G[A] += [B]\n G[B] += [A]\n\ncnt = 0\nfor i in range(1, N+1):\n flag = False\n for j in G[i]:\n if j == 0 and len(G[i]) == 1:\n flag = True\n break\n if H[i-1] <= H[j-1]:\n flag = False\n break\n else:\n flag = True\n if flag:\n cnt += 1\n\nprint(cnt)', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nG = dict()\nfor i in range(1, N+1):\n G[i] = [0]\n\nfor _ in range(M):\n A, B = map(int, input().split())\n G[A] += [B]\n G[B] += [A]\n\ncnt = 0\nfor i in range(1, N+1):\n flag = False\n if len(G[i]) > 1:\n for j in G[i]:\n if j == 0:\n continue\n if H[i-1] <= H[j-1]:\n flag = False\n break\n else:\n flag = True\n else:\n flag = True\n if flag:\n cnt += 1\n\nprint(cnt)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s869271668', 's912406893', 's969419558'] | [41092.0, 40864.0, 41044.0] | [447.0, 484.0, 478.0] | [504, 508, 552] |
p02689 | u596681540 | 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 = input().split()\nans = [1] * N\n\nprint(H)\nfor i in range(M):\n a, b = map(int, input().split())\n AH = int(H[a - 1])\n BH = int(H[b - 1])\n if AH >= BH:\n ans[b - 1] = 0\n elif BH >= AH:\n ans[a - 1] = 0\n\n\nprint(ans.count(1))\n', "import numpy as np\nN, M = map(int, input().split())\nH = []\nAB = []\nH = input().split()\n\nfor _ in range(M):\n a, b = map(int, input().split())\n AB.append([a, b])\n\nc = 0\ntopH = set([])\nrall = set((np.array(AB).flatten() - 1).tolist())\nHall = set(list(range(N)))\n# print(rall)\n# print(Hall - rall)\n\nfor i in range(M):\n AH = H[AB[i][0] - 1]\n BH = H[AB[i][1] - 1]\n if AH > BH:\n topH.add(AB[i][0] - 1)\n # if AB[i][1] - 1 in topH:\n # topH.remove(AB[i][1] - 1)\n elif BH > AH:\n topH.add(AB[i][1] - 1)\n # if AB[i][0] - 1 in topH:\n # topH.remove(AB[i][0] - 1)\n # else:\n # if AB[i][1] - 1 in topH:\n # topH.remove(AB[i][1] - 1)\n # if AB[i][0] - 1 in topH:\n # topH.remove(AB[i][0] - 1)\n\ntmp = Hall - rall\ntopH = topH | tmp\n\nprint(topH)\n\nfor i in list(topH):\n flg = True\n Hi = int(H[i])\n # print(topH)\n for m in range(M):\n if i + 1 in AB[m]:\n o_idx = 1 - AB[m].index(i + 1)\n h_idx = AB[m][o_idx]-1\n otherH = int(H[h_idx])\n # print(AB[m], i+1, o_idx, otherH, Hi)\n if Hi <= otherH:\n flg = False\n break\n\n if flg:\n c += 1\n\n# # print('c', c)\n\nprint(c)\n# print(len(topH))\n", "import numpy as np\nN, M = map(int, input().split())\nH = []\nAB = []\nH = input().split()\n\nfor _ in range(M):\n a, b = map(int, input().split())\n AB.append([a, b])\n\ntopH = set([])\nlowH = set([])\nrall = set((np.array(AB).flatten() - 1).tolist())\nHall = set(list(range(N)))\n\n# print('Hall - rall', Hall - rall)\n\n\nfor i in range(M):\n print(AB[i])\n AH = H[AB[i][0] - 1]\n BH = H[AB[i][1] - 1]\n # print(AB[i][0] - 1, AB[i][1] - 1)\n if AH >= BH:\n # topH.add(AB[i][0] - 1)\n lowH.add(AB[i][1] - 1)\n elif BH >= AH:\n # topH.add(AB[i][1] - 1)\n lowH.add(AB[i][0] - 1)\n\n# print('topH', topH)\nprint('lowH', lowH)\n\nreal_topH = (topH - lowH)\n# print(topH)\ntmp = (Hall) - rall\nreal_topH = real_topH | tmp\n# print((Hall) - rall)\n# print(Hall - lowH)\nprint(len(((Hall) - rall) | (Hall - lowH)))\n", "import numpy as np\nN, M = map(int, input().split())\nH = []\nAB = []\nH = input().split()\n\nfor _ in range(M):\n a, b = map(int, input().split())\n AB.append([a, b])\n\nc = 0\ntopH = set([])\nrall = set((np.array(AB).flatten() - 1).tolist())\nHall = set(list(range(N)))\n# print(rall)\n# print(Hall - rall)\n\nfor i in range(M):\n AH = H[AB[i][0] - 1]\n BH = H[AB[i][1] - 1]\n if AH > BH:\n topH.add(AB[i][0] - 1)\n if AB[i][1] - 1 in topH:\n topH.remove(AB[i][1] - 1)\n elif BH > AH:\n topH.add(AB[i][1] - 1)\n if AB[i][0] - 1 in topH:\n topH.remove(AB[i][0] - 1)\n else:\n if AB[i][1] - 1 in topH:\n topH.remove(AB[i][1] - 1)\n if AB[i][0] - 1 in topH:\n topH.remove(AB[i][0] - 1)\n\ntmp = Hall - rall\ntopH = topH | tmp\n\nprint(topH)\n\n\n# flg = True\n# Hi = int(H[i])\n# # print(topH)\n# for m in range(M):\n\n# o_idx = 1 - AB[m].index(i + 1)\n# h_idx = AB[m][o_idx]-1\n# otherH = int(H[h_idx])\n# # print(AB[m], i+1, o_idx, otherH, Hi)\n# if Hi <= otherH:\n# flg = False\n# break\n\n# if flg:\n# c += 1\n\n# # print('c', c)\n\n# print(c)\nprint(len(topH))\n", "import numpy as np\nN, M = map(int, input().split())\nH = []\nAB = []\nH = input().split()\n\nfor _ in range(M):\n a, b = map(int, input().split())\n AB.append([a, b])\n\nc = 0\ntopH = set([])\nrall = set((np.array(AB).flatten() - 1).tolist())\nHall = set(list(range(N)))\n# print(rall)\n# print(Hall - rall)\n\nfor i in range(M):\n AH = H[AB[i][0] - 1]\n BH = H[AB[i][1] - 1]\n if AH > BH:\n topH.add(AB[i][0] - 1)\n if AB[i][1] - 1 in topH:\n topH.remove(AB[i][1] - 1)\n elif BH > AH:\n topH.add(AB[i][1] - 1)\n if AB[i][0] - 1 in topH:\n topH.remove(AB[i][0] - 1)\n\ntmp = Hall - rall\ntopH = topH | tmp\n\nprint(topH)\n\n\n# flg = True\n# Hi = int(H[i])\n# # print(topH)\n# for m in range(M):\n\n# o_idx = 1 - AB[m].index(i + 1)\n# h_idx = AB[m][o_idx]-1\n# otherH = int(H[h_idx])\n# # print(AB[m], i+1, o_idx, otherH, Hi)\n# if Hi <= otherH:\n# flg = False\n# break\n\n# if flg:\n# c += 1\n\n# # print('c', c)\n\n# print(c)\nprint(len(topH))\n", 'import numpy as np\nN, M = map(int, input().split())\nAB = []\nH = [int(h) for h in input().split()]\nHall = [1] * N\n \n# print(H)\nfor i in range(M):\n a, b = map(int, input().split())\n AB.append([a, b])\n AH = H[a - 1]\n BH = H[b - 1]\n if AH >= BH:\n Hall[b - 1] = 0\n if BH >= AH:\n Hall[a - 1] = 0\n \n \nprint(Hall.count(1))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s070457038', 's198356294', 's312790843', 's488652900', 's835577195', 's957229809'] | [20312.0, 73700.0, 79080.0, 73520.0, 73672.0, 46760.0] | [578.0, 2208.0, 573.0, 540.0, 549.0, 412.0] | [283, 1275, 855, 1287, 1135, 346] |
p02689 | u600261652 | 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 resolve():\n N, M = map(int, input().split())\n H = list(map(int, input().split()))\n A = []\n B = []\n ans = 0\n for _ in range(M):\n a, b = map(int, input().split())\n A.append(a-1)\n B.append(b-1)\n while len(set(H)) != 0:\n v = H.index(max(H))+1\n for i in range(M):\n if A[i] == v:\n H[B[i]-1] = 0\n if B[i] == v:\n H[A[i]-1] = 0\n H[v-1] = 0\n ans += 1\n print(ans)\nresolve()', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\ncount = [0]*N\nans = 0\nfor _ in range(M):\n a, b = map(int, input().split())\n if H[a-1] > count[b-1]:\n count[b-1] = H[a-1]\n if H[b-1] > count[a-1]:\n count[a-1] = H[b-1]\nfor i in range(N):\n if H[i] > count[i]:\n ans += 1\nprint(ans)'] | ['Time Limit Exceeded', 'Accepted'] | ['s930045341', 's349668328'] | [28704.0, 20012.0] | [2206.0, 299.0] | [491, 329] |
p02689 | u602500004 | 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 math\nimport numpy as np\nimport sys\nimport os\nfrom operator import mul\nfrom operator import itemgetter\n\nsys.setrecursionlimit(10**7)\n\ndef _S(): return sys.stdin.readline().rstrip()\ndef I(): return int(_S())\ndef LS(): return list(_S().split())\ndef LI(): return list(map(int,LS()))\n\nif os.getenv("LOCAL"):\n inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+\'.txt\'\n sys.stdin = open(inputFile, "r")\nINF = float("inf")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n# MOD = 998244353 \n\nN,M = LI()\nH = LI()\nAB = [LI() for _ in range(M)]\n\np = []\nd = {}\nfor i in range(N):\n # p.append((i,H[i]))\n d[i]=H[i]\n# p.sort(key=itemgetter(1),reverse=True)\n# print(p)\nprint(d)\n\n\ng = [set()] * N\na = [True] * N\n\nfor i in range(M):\n f = AB[i][0]-1\n t = AB[i][1]-1\n if d[t]>d[f]:\n a[f]=False\n elif d[f]>d[t]:\n a[t]=False\n else:\n a[f]=False\n a[t]=False\n# print(a)\nprint(sum(a)) \n # print(g[f])\n # g[f] = np.append(g[f],t)\n # g[t] = np.append(g[t],f)\n \n # g[f][t]=1\n # g[t][f]=1\n\n# print(g)\n# list.sort(key=itemgetter(0))\n\n\n\n\n# a = np.where(g[0]==1)\n# print(a)', 'import math\nimport numpy as np\nimport sys\nimport os\nfrom operator import mul\nfrom operator import itemgetter\n\nsys.setrecursionlimit(10**7)\n\ndef _S(): return sys.stdin.readline().rstrip()\ndef I(): return int(_S())\ndef LS(): return list(_S().split())\ndef LI(): return list(map(int,LS()))\n\nif os.getenv("LOCAL"):\n inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+\'.txt\'\n sys.stdin = open(inputFile, "r")\nINF = float("inf")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n# MOD = 998244353 \n\nN,M = LI()\nH = LI()\nAB = [LI() for _ in range(M)]\n\np = []\nd = {}\nfor i in range(N):\n # p.append((i,H[i]))\n d[i]=H[i]\n# p.sort(key=itemgetter(1),reverse=True)\n# print(p)\n# print(d)\n\n\ng = [set()] * N\na = [True] * N\n\nfor i in range(M):\n f = AB[i][0]-1\n t = AB[i][1]-1\n if d[t]>d[f]:\n a[f]=False\n elif d[f]>d[t]:\n a[t]=False\n else:\n a[f]=False\n a[t]=False\n# print(a)\nprint(sum(a)) \n # print(g[f])\n # g[f] = np.append(g[f],t)\n # g[t] = np.append(g[t],f)\n \n # g[f][t]=1\n # g[t][f]=1\n\n# print(g)\n# list.sort(key=itemgetter(0))\n\n\n\n\n# a = np.where(g[0]==1)\n# print(a)'] | ['Wrong Answer', 'Accepted'] | ['s543144883', 's044046103'] | [61120.0, 60544.0] | [405.0, 390.0] | [1199, 1201] |
p02689 | u604412462 | 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()))\nq = [1]*1\nfor i in range(m):\n a,b = map(int,input().split())\n if h[a-1] < h[b-1]:\n q[a-1] = 0\n elif h[a-1] > h[b-1]:\n q[b-1] = 0\n else:\n q[a-1] = 0\n q[b-1] = 0\nprint(q.count(1))', 'n,m = map(int,input().split())\nh = list(map(int,input().split()))\nc = dict()\nfor i in range(m):\n a, b = map(int,input().split())\n if a in c:\n c[a].append(b)\n else:\n c[a] = [b]\n if b in c:\n c[b].append(a)\n else:\n c[b] = [a]\n \ncnt = n\nfor k,v in c.items():\n for i in range(len(v)):\n if h[v[i] - 1] >= h[k - 1]:\n cnt -= 1\n break\nprint(cnt)'] | ['Runtime Error', 'Accepted'] | ['s243528001', 's006010231'] | [19972.0, 31912.0] | [40.0, 402.0] | [283, 418] |
p02689 | u605161376 | 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\nlst = [0 for i in range(N)]\n\nfor m in range(M):\n a,b = map(int, input().split())\n a-=1\n b-=1\n if lst[a] > lst[b]:\n lst[b]-=1\n elif lst[a] < lst[b]:\n lst[b]-=1\n\nprint(lst.count(0))', 'N,M = map(int, input().split())\nH = list(map(int, input().split()))\n\nlst = [0 for i in range(N)]\n\nfor m in range(M):\n a,b = map(int, input().split())\n a-=1\n b-=1\n if H[a] > H[b]:\n lst[b]-=1\n elif H[a] < H[b]:\n lst[a]-=1\n else:\n lst[a]-=1\n lst[b]-=1\n\nprint(lst.count(0))'] | ['Wrong Answer', 'Accepted'] | ['s191993095', 's343093457'] | [20064.0, 20112.0] | [242.0, 268.0] | [277, 315] |
p02689 | u607563136 | 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(int,input().split())) for _ in range(m)]\n\n\npoint = [0]*n\napp = [0]*n\ncnt = []\n\nfor i in ab:\n app[i[0]-1] += 1\n app[i[1]-1] += 1\n if h[i[0]-1] > h[i[1]-1]:\n point[i[0]-1] += 1\n elif h[i[0]-1] < h[i[1]-1]:\n point[i[1]-1] += 1\nfor i in range(n):\n if app[i] == point[i]:\n cnt.append(i+1)\nprint(cnt)', 'n, m = map(int,input().split())\n\nh = list(map(int,input().split()))\n\nmj = []\n\nfor i in range(m):\n mj.append(list(map(int,input().split())))\n \ntower = 0\n\nfor i in range(n):\n \n cnt = 0\n h_high = 0\n for j in range(m):\n if i+1 in mj[j]:\n cnt += 1\n if i == mj[j][0]-1:\n if h[i] > h[mj[j][1]-1]:\n h_high += 1\n else:\n if h[i] > h[mj[j][0]-1]:\n h_high += 1\n if cnt == h_high:\n tower += 1\n \nprint(len(tower))', 'point = [0]*n\napp = [0]*n\ncnt = []\n\nfor i in ab:\n app[i[0]-1] += 1\n app[i[1]-1] += 1\n if h[i[0]-1] > h[i[1]-1]:\n point[i[0]-1] += 1\n elif h[i[0]-1] < h[i[1]-1]:\n point[i[1]-1] += 1\nfor i in range(n):\n if app[i] == point[i]:\n cnt.append(i+1)\nprint(cnt)', 'n, m = map(int,input().split())\nh = list(map(int,input().split()))\n\nab = [list(map(int,input().split())) for _ in range(m)]\n\n\npoint = [0]*n\napp = [0]*n\ncnt = []\n\nfor i in ab:\n app[i[0]-1] += 1\n app[i[1]-1] += 1\n if h[i[0]-1] > h[i[1]-1]:\n point[i[0]-1] += 1\n elif h[i[0]-1] < h[i[1]-1]:\n point[i[1]-1] += 1\nfor i in range(n):\n if app[i] == point[i]:\n cnt.append(i+1)\nprint(len(cnt))\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s014290522', 's352860047', 's507884516', 's974567780'] | [37032.0, 31236.0, 8940.0, 35920.0] | [357.0, 2206.0, 26.0, 350.0] | [413, 631, 287, 419] |
p02689 | u609307781 | 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? | ["# C\nimport numpy as np\n\ninp = input().split(' ')\nN, M = int(inp[0]), int(inp[1])\n\ninps = input().split(' ')\nH = np.array([int(inps[i]) for i in range(len(inps))])\nAB = []\nfor i in range(M):\n inps = input().split(' ')\n AB.append(set([int(inps[0]), int(inps[1])]))\n \ndef get_height(els):\n return H[els[0]-1] > H[els[1]-1]\n\ndef get_height_sum(arr):\n if not arr:\n return 1\n return np.prod(list(map(get_height, arr)))\n\ndef tmp(arr_arr):\n return (list(map(get_height_sum, arr_arr)))\n return sum(list(map(get_height_sum, arr_arr)))\n\nconnected = [[[i+1] + list(ab - {i+1}) for ab in AB if i+1 in ab] for i in range(N)]\n\nprint(int(tmp(connected)))", "# C\nimport numpy as np\n\ninp = input().split(' ')\nN, M = int(inp[0]), int(inp[1])\n\ninps = input().split(' ')\nH = np.array([int(inp) for inp in range(len(inps))])\nAB = []\nfor i in range(M):\n inps = input().split(' ')\n AB.append(set([int(inps[0]), int(inps[1])]))\n \ndef get_height(els):\n return H[els[0]-1] >= H[els[1]-1]\n\ndef get_height_sum(arr):\n return np.prod(list(map(get_height, arr)))\n\ndef tmp(arr_arr):\n return (list(map(get_height_sum, arr_arr)))\n\nconnected = [[[i+1] + list(ab - {i+1}) for ab in AB if i+1 in ab] for i in range(N)]\n\nprint(int(tmp(connected)))", "# C\nimport numpy as np\n\ninp = input().split(' ')\nN, M = int(inp[0]), int(inp[1])\n\ninps = input().split(' ')\nH = np.array([int(inp) for inp in range(len(inps))])\nAB = []\nfor i in range(M):\n inps = input().split(' ')\n AB.append(set([int(inps[0]), int(inps[1])]))\n \ndef get_height(els):\n return H[els[0]-1] >= H[els[1]-1]\n\ndef get_height_sum(arr):\n return np.prod(list(map(get_height, arr)))\n\ndef tmp(arr_arr):\n return sum(list(map(get_height_sum, arr_arr)))\n\nconnected = [[[i] + list(ab - {i+1}) for ab in AB if i+1 in ab] for i in range(N)]\n\nprint(int(tmp(connected)))", '# C\nN, M = map(int, input().split())\nH = list(map(int, input().split()))\n\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])\n \nres = sum([H[i] > A[i] for i in range(N)])\nprint(res)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s173951400', 's217638153', 's906472285', 's347749002'] | [58632.0, 58640.0, 58636.0, 19956.0] | [2207.0, 2207.0, 2207.0, 344.0] | [669, 584, 585, 266] |
p02689 | u609814378 | 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 math\nimport sys\n\nN,M= map(int, input().split())\nH = list(map(int, input().split())) \n\nlis = [0] * N \n\n\nfor _ in range(M):\n A, B = map(int, input().split())\n\n hightA = H[A-1]\n hightB = H[B-1]\n\n if hightA < hightB:\n if lis[B-1] == 0:\n lis[B-1] = 1\n lis[A-1] = -1\n \n elif lis[B-1] == 1 or lis[B-1] == -1:\n lis[A-1] = -1\n \n if hightB < hightA:\n if lis[A-1] == 0:\n lis[A-1] = 1\n lis[B-1] = -1\n \n elif lis[A-1] == 1 or lis[A-1] == -1:\n lis[B-1] = -1\n\n if hightB == hightA:\n lis[A-1] = -1\n lis[B-1] = -1\n\nprint(lis)', 'import math\nimport sys\n\nN,M= map(int, input().split())\nH = list(map(int, input().split())) \n\nlis = [0] * N \n\n\nfor _ in range(M):\n A, B = map(int, input().split())\n\n hightA = H[A-1]\n hightB = H[B-1]\n\n if hightA < hightB:\n if lis[B-1] == 0:\n lis[B-1] = 1\n lis[A-1] = -1\n \n elif lis[B-1] == 1 or lis[B-1] == -1:\n lis[A-1] = -1\n \n if hightB < hightA:\n if lis[A-1] == 0:\n lis[A-1] = 1\n lis[B-1] = -1\n \n elif lis[A-1] == 1 or lis[A-1] == -1:\n lis[B-1] = -1\n\n if hightB == hightA:\n lis[A-1] = -1\n lis[B-1] = -1\n\nans = 0\nfor i in lis:\n if i == 0 or i == 1:\n ans = ans + 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s674714258', 's697510031'] | [20132.0, 20028.0] | [280.0, 282.0] | [659, 724] |
p02689 | u613350811 | 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\nG = [1] * N\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n me = A[i-1]\n t = B[i-1]\n if H[me-1] <= H[t-1]:\n G[me-1] = 0\n\n me = B[i-1]\n t = A[i-1]\n if H[me-1] <= H[t-1]:\n G[me-1] = 0\nprint(G.count(1))', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\nA = [0] * M\nB = [0] * M\nG = [1] * N\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n me = A[i]-1\n t = B[i]-1\n if H[me] <= H[t]:\n G[me] = 0\n\n me = B[i]-1\n t = A[i]-1\n if H[me] <= H[t]:\n G[me] = 0\nprint(G.count(1))'] | ['Wrong Answer', 'Accepted'] | ['s785789313', 's378079415'] | [21776.0, 21772.0] | [315.0, 302.0] | [339, 327] |
p02689 | u615576660 | 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 = list(map(int,input().split()))\nroad_list = []\n\nfor i in range(M):\n road_list.append(list(map(int,input().split())))\n \nprint(height_list)\nprint(road_list)\nprint(road_list[0])', 'n, m = map(int, input().split())\nhs = list(map(int, input().split()))\n\nedge = [[] for _ in range(n)]\n\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n edge[a].append(b)\n edge[b].append(a)\n\ncnt = 0\n\nfor node in range(n):\n good = True\n for neighbor in edge[node]:\n if hs[node] <= hs[neighbor]:\n good = False\n if good:\n cnt += 1\n\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s238835132', 's323191295'] | [35056.0, 29428.0] | [300.0, 383.0] | [224, 407] |
p02689 | u616382321 | 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\ncnt = 0\nfor n in range(1,N+1):\n adj = []\n adj.append([n])\n for i in AB:\n if n in i:\n adj.append(i)\n adj = set(sum(adj,[]))\n adj_H = [H[s-1] for s in adj]\n if max(adj_H) == H[n-1] and adj_H.count(max(adj_H)) == 1:\n ans.append(n)\n cnt += 1\n\nprint(cnt)\n', 'N, M = map(int, input().split())\nH = list(map(int, input().split()))\ng = [[] for _ in range(N+1)]\n\nfor _ in range(M):\n a, b = map(int, input().split())\n g[a].append(b)\n g[b].append(a)\n\ncnt = 0\nfor n in range(1,N+1):\n for i in g[n]:\n if H[n-1] <= H[i-1]:\n break\n else:\n cnt += 1\n\nprint(cnt)\n'] | ['Runtime Error', 'Accepted'] | ['s209740166', 's947446662'] | [31220.0, 29464.0] | [279.0, 339.0] | [427, 330] |
p02689 | u619144316 | 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())\nH = list(map(int,input().split()))\ngraph = defaultdict(list)\nfor _ in range(M-1):\n A, B = map(int,input().split())\n graph[A].append(H[B-1])\n graph[B].append(H[A-1])\n\ncnt = 0\nfor i in range(1,N+1):\n t = H[i-1]\n a = max(graph[i])\n if t >a:\n cnt += 1\nprint(cnt)', 'from collections import defaultdict\n\nN ,M = map(int,input().split())\nH = list(map(int,input().split()))\ngraph = defaultdict(int)\nfor _ in range(M):\n A, B = map(int,input().split())\n graph[A]= max(graph[A],H[B-1])\n graph[B]= max(graph[B],H[A-1])\n\nprint(sum(H[i-1] > graph[i] for i in range(1,N+1)))'] | ['Runtime Error', 'Accepted'] | ['s204283219', 's827878699'] | [28184.0, 24712.0] | [318.0, 356.0] | [352, 306] |
p02689 | u620238824 | 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(map(int, input().split())) for i in range(M)] γθ€ζ°θ‘θ€ζ°ε\n\ngood = []\nbad = []\nfor i in range(M):\n left = H[A[i][0] - 1]\n right = H[A[i][1] - 1]\n if left < right:\n good.append(A[i][1])\n bad.append(A[i][0])\n if left > right:\n good.append(A[i][0])\n bad.append(A[i][1])\n if left == right:\n bad.append(A[i][0])\n bad.append(A[i][1])\n\n#print(set(good))\n#print(set(bad))\n\nlonely = H - set(good) - set(bad)\n\n#print(len(lonely))\n#print(len(good))\nprint(len(set(good))+ len(lonely))', 'N, M = map(int, input().split()) \nH = list(map(int, input().split()))\nA = [list(map(int, input().split())) for i in range(M)] γθ€ζ°θ‘θ€ζ°ε\n\ngood = [True]*N\nfor i, j in A:\n print(i,j)\n i -= 1\n j -= 1\n if H[i] < H[j]:\n good[i] = False\n if H[i] > H[j]:\n good[j] = False\n if H[i] == H[j]:\n good[i] = False\n good[j] = False\n\nprint(good.count(True))', 'N, M = map(int, input().split()) \nH = list(map(int, input().split()))\nA = [list(map(int, input().split())) for i in range(M)] γθ€ζ°θ‘θ€ζ°ε\n\ngood = []\nbad = []\nfor i in range(M):\n left = H[A[i][0] - 1]\n right = H[A[i][1] - 1]\n if left < right:\n good.append(A[i][1])\n bad.append(A[i][0])\n if left > right:\n good.append(A[i][0])\n bad.append(A[i][1])\n if left == right:\n bad.append(A[i][0])\n bad.append(A[i][1])\n\nB = list(i for i in set(good))\nC = list(i for i in set(bad))\n\n\n#print(C)\n\nD = list(i for i in B if i not in C)\nE = D + C\nF = list(i for i in range(1,N+1) if i not in E)\n\n#print(D)\n#print(F)\nprint(len(D) + len(F))', 'N, M = map(int, input().split()) \nH = list(map(int, input().split()))\nA = [list(map(int, input().split())) for i in range(M)] γθ€ζ°θ‘θ€ζ°ε\n\ngood = [True]*N\nfor i in range(M):\n left = H[A[i][0] - 1]\n right = H[A[i][1] - 1]\n if left < right:\n good[A[i][0]] = False\n if left > right:\n good[A[i][1]] = False\n if left == right:\n good[A[i][0]] = False\n good[A[i][1]] = False\n\nprint(good.count(True))', 'N, M = map(int, input().split()) \nH = list(map(int, input().split()))\nA = [list(map(int, input().split())) for i in range(M)] γθ€ζ°θ‘θ€ζ°ε\n\ngood = []\nbad = []\nfor i in range(len(A)):\n if H[A[i][0] - 1] < H[A[i][1] - 1]:\n good.append(A[i][1])\n bad.append(A[i][0])\n if H[A[i][0] - 1] > H[A[i][1] - 1]:\n good.append(A[i][0])\n bad.append(A[i][1])\n if H[A[i][0] - 1] == H[A[i][1] - 1]:\n bad.append(A[i][0])\n bad.append(A[i][1])\n\n#print(set(good))\n#print(set(bad))\n\nlonely = []\nfor i in range(1, N + 1):\n lonely.append(i)\n\nfor i in set(good):\n lonely.remove(i)\n\nfor i in set(bad):\n lonely.remove(i)\n\n#print(len(lonely))\n#print(len(good))\nprint(len(set(good))+ len(lonely))', 'n, m = map(int, input().split())\nh = list(map(int, input().split()))\n\nl = [True] * n\nfor i in range(m):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n #print(h[a],h[b])\n if h[a] >= h[b]:\n l[b] = False\n if h[a] <= h[b]:\n l[a] = False\n\n#print(l)\nprint(l.count(True))'] | ['Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s229157155', 's230217756', 's400471465', 's789422167', 's937147422', 's138896017'] | [36384.0, 32284.0, 36408.0, 32024.0, 39696.0, 19960.0] | [348.0, 348.0, 2206.0, 319.0, 2207.0, 246.0] | [644, 424, 722, 471, 761, 300] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.