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
|
---|---|---|---|---|---|---|---|---|---|---|
p02642 | u152741807 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\nn = int(input())\na = np.sort(np.array(list(map(int, input().split()))))\nmax_num = np.max(a)+1\ndp = np.array([True]*(max_num))\n\nif np.all(a==a[0]):\n print(0)\nelse:\n for i in range(1,max_num):\n if dp[i] and i in a:\n for j in np.arange(i*2, max_num, i):\n dp[j] = False\n if np.count_nonzero(a==i) >1:\n dp[i] = False\n print(np.count_nonzero(dp[np.a] == True))', 'import numpy as np\nn = int(input())\na = np.sort(np.array([int(x) for x in input().split()]))\nmax_num = np.max(a)+1\ndp = np.array([True]*(max_num))\n\nif np.all(a==a[0]):\n print(0)\nelif np.count_nonzero(a==1) == 1:\n print(1)\nelse:\n for i in range(1,max_num):\n if dp[i] and i in a:\n for j in np.arange(i*2, max_num, i):\n dp[j] = False\n print(dp)\n print(np.count_nonzero(dp[a] == True))', 'import numpy as np\nn = int(input())\na = np.sort(np.array(list(map(int, input().split()))))\nmax_num = np.max(a)+1\ndp = np.array([True]*(max_num))\n\nif np.all(a==a[0]):\n print(0)\nelse:\n for i in range(1,max_num):\n if dp[i] and i in a:\n for j in np.arange(i*2, max_num, i):\n dp[j] = False\n print(dp)\n print(np.count_nonzero(dp[a] == True))', 'import numpy as np\nn = int(input())\na = np.sort(np.array(list(map(int, input().split()))))\nmax_num = a[-1]+1\ndp = np.array([0]*(max_num))\n\nif np.count_nonzero(a==1) >= 1:\n if np.count_nonzero(a==1) >1:\n print(0)\n else:\n print(1)\nelse:\n for i in a:\n for j in np.arange(i, max_num, i):\n dp[j] += 1\n print(np.count_nonzero(dp[a] == 1))'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s519128975', 's636780303', 's875138104', 's478535182'] | [51312.0, 51588.0, 51696.0, 51324.0] | [2207.0, 2206.0, 2206.0, 1936.0] | [433, 430, 380, 378] |
p02642 | u153094838 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['# -*- coding: utf-8 -*-\n"""\nCreated on Sun Jun 14 21:14:26 2020\n\n@author: NEC-PCuser\n"""\n\nN = int(input())\nA = list(map(int, input().split()))\n\nA.sort()\n\n\nli = []\nli2 = []\nbefore_value = 0\nnext_flg = False\nfor n in A:\n if len(li) == 0:\n li.append(n)\n li2.append(n)\n next_flg = True\n if before_value == n:\n if li[len(li) - 1] == n:\n li.pop(len(li) - 1)\n next_flg = False\n before_value = n\n continue\n before_value = n\n if next_flg is True:\n next_flg = False\n continue\n for n2 in li2:\n if (n % n2 == 0):\n break\n if (n < n2 * n2):\n li.append(n)\n break\n else:\n li.append(n)\n\nprint(len(li))', '# -*- coding: utf-8 -*-\n"""\nCreated on Sun Jun 14 21:14:26 2020\n\n@author: NEC-PCuser\n"""\n\nN = int(input())\nA = list(map(int, input().split()))\n\nA.sort()\n\n\nli = []\nbefore_value = 0\nnext_flg = False\nfor n in A:\n if len(li) == 0:\n li.append(n)\n next_flg = True\n if before_value == n:\n if li[len(li) - 1] == n:\n li.pop(len(li) - 1)\n next_flg = False\n before_value = n\n continue\n before_value = n\n if next_flg is True:\n next_flg = False\n continue\n \n\nprint(len(li))', '# -*- coding: utf-8 -*-\n"""\nCreated on Sun Jun 14 21:14:26 2020\n\n@author: NEC-PCuser\n"""\n\nN = int(input())\nA = list(map(int, input().split()))\n\na = [0] * (10 ** 6)\n\nfor i in A:\n first_flg = True\n for j in range(i, 10 ** 6 + 1, i):\n if first_flg == True and a[j - 1] != 0:\n a[j - 1] += 1\n break\n a[j - 1] += 1\n first_flg = False\n\n\ncount = 0\nfor i in A:\n if a[i - 1] == 1:\n count+=1\n\nprint(count)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s479082831', 's985499919', 's506059859'] | [33212.0, 31028.0, 32012.0] | [235.0, 206.0, 954.0] | [730, 733, 453] |
p02642 | u156815136 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["#from statistics import median\n#import collections\n\n#from fractions import gcd\n#from itertools import combinations # (string,3) 3回\n#from collections import deque\nfrom collections import deque,defaultdict\n\n#\n# d = m - k[i] - k[j]\n\n#\n#\n#\n\n#\n#\n\nimport sys\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n#mod = 9982443453\ndef readInts():\n return list(map(int,input().split()))\ndef I():\n return int(input())\nn = I()\nA = sorted(readInts())\ndic = defaultdict(int)\ncnt = 0\nA = set(A)\n# ------------\nis_prime = [True] * (10**6+1)\n#print('a')\nfor i in range(n):\n #ll += 1\n #print(i)\n if is_prime[A[i]] == True:\n for j in range(2*A[i], 10**6+1,A[i]):\n is_prime[j] = False \n\n # -----------\nfor i in A:\n dic[i] += 1\ncnt = 0\nif A[0] == 1:\n if dic[1] >= 2:\n print(0)\n exit()\n else:\n print(1)\n exit()\nfor a in A:\n if is_prime[a] and not dic[a] >= 2:\n #print(a)\n cnt += 1\nprint(cnt)\n", "#from statistics import median\n#import collections\n\nfrom math import gcd\nfrom itertools import combinations,permutations,accumulate, product \n#from collections import deque\nfrom collections import deque,defaultdict,Counter\nimport decimal\nimport re\nimport math\nimport bisect\nimport heapq\n#\n#\n#\n\n#\n#\n# my_round_int = lambda x:np.round((x*2 + 1)//2)\n\n#\n\n\n\n#\n#\nimport sys\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n#mod = 9982443453\n#mod = 998244353\nINF = float('inf')\nfrom sys import stdin\nreadline = stdin.readline\ndef readInts():\n return list(map(int,readline().split()))\ndef readTuples():\n return tuple(map(int,readline().split()))\ndef I():\n return int(readline())\nn = I()\n\nA = readInts()\n\nis_ok = [0] * (10**6+1)\nse = set(A)\nC = Counter(A)\nfor a in se:\n for b in range(a,10**6+1,a):\n is_ok[b] += 1\nans = 0\nfor i in range(n):\n if C[A[i]] >= 2:\n continue\n if is_ok[A[i]] == 1:\n ans += 1\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s844876628', 's741494534'] | [35176.0, 54928.0] | [178.0, 1856.0] | [1224, 1280] |
p02642 | u161164709 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = sorted(list(map(int, input().split())))\n\ndata = [True]*N\n\nfor i in range(N):\n if data[i]:\n for j in range(i,N):\n if A[i]==A[j]:\n data[i]=False\n data[j]=False\n elif A[j]%A[i]==0:\n data[j]=False\n\nprint(data.count(True))\n', 'from collections import Counter\nN = int(input())\nA = sorted(list(map(int, input().split())))\ncount = Counter(A)\n\nmax_len_A = 10**6+1\ndata = [0]*max_len_A\nA = list(set(A))\n\nfor a in A:\n if data[a]==0:\n for j in range(a+a, max_len_A, a):\n data[j]+=1\n\n\nans = len([a for a in A if data[a]==0 and count[a]==1])\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s036337422', 's867606517'] | [32144.0, 52432.0] | [2206.0, 480.0] | [316, 337] |
p02642 | u164471280 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["from collections import deque\nn = int(input())\nL = []\nfor i in range(n):\n L.append(input())\n\nANS = ['blank page']\nd = deque()\nd.append('blank page')\n\nfor i in range(1, n):\n if L[i] == 'use the back button':\n d.pop()\n t = d.pop()\n ANS.append(t)\n d.append(t)\n else:\n s = L[i][6:]\n ANS.append(s)\n d.append(s)\n \n \n # ANS.append(' '.join(s))\n # d.append(' '.join(s))\n\nfor i in ANS:\n print(i)", 'from collections import defaultdict\nimport sys\nn = int(input())\nA = list(map(int, input().split()))\n\n# if n == 1:\n# print(1)\n# sys.exit()\n\nd = defaultdict(int)\n\nfor key in A:\n d[key] += 1\n\n\n# print(0)\n# sys.exit()\n\nB = list(d)\n# B.sort()\n\n\n# print(d[1])\n# sys.exit()\n# length = len(d)\nm = max(d)\nflag = [0 for i in range(m+1)]\n\nfor i in B:\n t = i\n while t <= m:\n flag[t] += 1\n t += i\n\nans = 0\nfor i in B:\n if flag[i] == 1 and d[i] == 1:\n ans += 1\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s795235955', 's838779458'] | [13596.0, 44664.0] | [30.0, 623.0] | [504, 590] |
p02642 | u167908302 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['# coding:utf-8\nn = int(input())\na = list(map(int, input().split()))\nm = max(a)\ncount = [0 for _ in range(m + 1)]\nans = 0\n\nfor i in a:\n if count[i] != 0:\n count[i] = 2\n continue\n for j in range(i, m + 1, i):\n count[j] += 1\n\nprint(count)\n\nfor i in a:\n if count[i] == 1:\n print(i)\n ans += 1\n\nprint(ans)\n', '# coding:utf-8\nn = int(input())\na = list(map(int, input().split()))\nm = max(a)\ncount = [0 for _ in range(m + 1)]\nans = 0\n\nfor i in a:\n if count[i] != 0:\n count[i] = 2\n continue\n for j in range(i, m + 1, i):\n count[j] += 1\n\n\nfor i in a:\n if count[i] == 1:\n # print(i)\n ans += 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s805465629', 's724835524'] | [32936.0, 32168.0] | [565.0, 440.0] | [344, 333] |
p02642 | u169678167 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from sys import stdin\nimport numpy as np\ninput = stdin.readline\n\nN = int(input())\nA_list = list(map(int, input().split()))\n# ans_list =np.ones(N)\n# A_list = np.array(A_list)\n\n\n# for j in range(i+1,N):\n# if A_list[i] % A_list[j] == 0:\n# ans_list[i] = 0\n# if (A_list[j] % A_list[i] == 0):\n# ans_list[j] = 0\n# elif(A_list[j] % A_list[i] == 0):\n# ans_list[j] = 0\n# print(int(np.sum(ans_list)))\nA_set = list(set(A_list))\nmaxA = A_set[-1]\ndp = [1] * (( 10 ** 6) + 1)\n\ncntli = [0] * (( 10 ** 6) + 1)\nunique =[]\nfor i in A_list:\n cntli[i] += 0\nfor i in range((( 10 ** 6) + 1)):\n if cntli[i] == 1:\n unique.append[i]\n\nfor elem in A_set:\n for i in range(2 * elem, 10 ** 6 + 1, elem):\n dp[i] = 0\n\nans = 0\nfor i in unique:\n if not (dp[i] == 0):\n ans += 1\n\nprint(ans)\n\n\n\n\n', 'from sys import stdin\nimport numpy as np\ninput = stdin.readline\n\nN = int(input())\nA_list = list(map(int, input().split()))\n# ans_list =np.ones(N)\n# A_list = np.array(A_list)\n\n\n# for j in range(i+1,N):\n# if A_list[i] % A_list[j] == 0:\n# ans_list[i] = 0\n# if (A_list[j] % A_list[i] == 0):\n# ans_list[j] = 0\n# elif(A_list[j] % A_list[i] == 0):\n# ans_list[j] = 0\n# print(int(np.sum(ans_list)))\nA_set = list(set(A_list))\nmaxA = A_set[-1]\ndp = [1] * (( 10 ** 6) + 1)\n\ncntli = [0] * (( 10 ** 6) + 1)\nunique =[]\nfor i in A_list:\n cntli[i] += 1\nfor i in range((( 10 ** 6) + 1)):\n if cntli[i] == 1:\n unique.append(i)\n\nfor elem in A_set:\n for i in range(2 * elem, 10 ** 6 + 1, elem):\n dp[i] = 0\n\nans = 0\nfor i in unique:\n if not (dp[i] == 0):\n ans += 1\n\nprint(ans)\n\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s238842954', 's080122222'] | [53592.0, 60652.0] | [1850.0, 1613.0] | [890, 890] |
p02642 | u173148629 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N=int(input())\nA=list(map(int,input().split()))\n\nM=max(A)\ncheck=[0]*(M+1)\nfor i in range(N):\n a=A[i]\n if check[a]>0:\n continue\n while a<=M:\n check[a]+=1\n a+=A[i]\nans=0\nfor i in range(N):\n if check[A[i]]==1:\n ans+=1\n\nprint(ans)', 'N=int(input())\nA=list(map(int,input().split()))\n\nM=max(A)\ncheck=[0]*(M+1)\n#A.sort()\nfor i in range(N):\n a=A[i]\n if check[a]>1:\n continue\n while a<=M:\n check[a]+=1\n a+=A[i]\nans=0\nfor i in range(N):\n if check[A[i]]==1:\n ans+=1\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s010237084', 's019946723'] | [32316.0, 32220.0] | [578.0, 614.0] | [266, 276] |
p02642 | u175034939 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\nA = list(map(int,input().split()))\nA.sort()\n\nac = A.count(1)\nif ac == 1:\n print(1)\n exit()\nif ac >= 2:\n print(0):\n exit()\n\nnum = [0]*1000005\nfor a in A:\n num[a] += 1\n\nb = [False]*1000005\nseen = [False]*1000005\ncnt = 0\nA = list(set(A))\nA.sort()\nfor a in A:\n if seen[a]:\n continue\n\n seen[a] = True\n if b[a] == False:\n cnt += 1\n if num[a] > 1:\n cnt -= 1\n\n for i in range(a, 1000005, a):\n b[i] = True\nprint(cnt)', 'n = int(input())\nA = list(map(int,input().split()))\n\nnum = [0]*(10**6+1)\nfor a in A:\n num[a] += 1\n\nbai = [False]*(10**6+1)\ncnt = 0\nA = list(set(A))\nA.sort()\nfor a in A:\n if bai[a]:\n continue\n\n if num[a] == 1:\n cnt += 1\n\n for i in range(a, 10**6+1, a):\n bai[i] = True\nprint(cnt)'] | ['Runtime Error', 'Accepted'] | ['s117402227', 's815069370'] | [9020.0, 47812.0] | [25.0, 347.0] | [490, 310] |
p02642 | u179376941 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\nlst = [int(i) for i in input().split()]\nlst.sort()\n#print(lst)\n\nif lst[0] == 1:\n if n > 1:\n if lst[0] == lst[1]:\n print(0)\n else:\n print(1)\n else:\n print(1)\nelse:\n tf_lst = [1] * lst[n - 1]\n count = 0\n if n > 1:\n pre = 0\n for i in range(n):\n if tf_lst[lst[i] - 1] == 0:\n continue\n tf_lst[pre:lst[i] - 1] = [0] * (lst[i] - pre - 1)\n pre = lst[i]\n if i <= n - 2:\n if lst[i] == lst[i + 1]:\n tf_lst[lst[i] - 1] = 0\n for j in range(2, lst[n - 1] // lst[i] + 1):\n if lst[i] * j in lst:\n tf_lst[lst[i] * j - 1] = 0\n #print(tf_lst)\n for i in tf_lst:\n count += i\n else:\n count += 1\n print(count)\n', 'n = int(input())\nlst = [int(i) for i in input().split()]\nlst.sort()\n#print(lst)\n\nif 1 in lst:\n count = 0\n for i in range(n):\n if lst[i] == 1:\n count += 1\n if count == 2:\n break\n if count == 1:\n print(1)\n else:\n print(0)\nelse:\n tf_lst = [1] * lst[n - 1]\n count = 0\n if n > 1:\n pre = 0\n for i in range(n):\n tf_lst[pre:lst[i] - 1] = [0] * (lst[i] - pre - 1)\n pre = lst[i]\n if tf_lst[lst[i] - 1] == 0:\n continue\n if i <= n - 2:\n if lst[i] == lst[i + 1]:\n tf_lst[lst[i] - 1] = 0\n for j in range(lst[i] * 2, lst[n - 1] + 1, lst[i]):\n tf_lst[j - 1] = 0\n #print(tf_lst)\n for i in tf_lst:\n count += i\n else:\n count += 1\n print(count)\n'] | ['Wrong Answer', 'Accepted'] | ['s414851129', 's354706965'] | [43080.0, 41740.0] | [2206.0, 481.0] | [714, 731] |
p02642 | u185896732 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10**6)\nfrom numba import jit\n\n@jit\ndef Ed(num):\n ret=set()\n for i in range(1,int(num**0.5)+1):\n if num%i==0:\n ret.add(i)\n if num//i!=i:\n ret.add(num//i)\n return ret\n\n@jit\ndef main():\n n=int(input().rstrip())\n ans=0\n a=sorted([int(i) for i in input().split()])\n for i in range(n):\n if i!=n-1:\n if a[i+1]==a[i]:continue\n yaku=Ed(a[i])\n for j in range(i):\n if a[j] in yaku:\n break\n else:\n #print(a[i])\n ans+=1\n print(ans)\n\nif __name__=="__main__":main()', 'import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10**6)\nfrom numba import jit\n\n@jit\ndef main():\n n=int(input().rstrip())\n a=sorted([int(i) for i in input().split()])\n maxn=10**6+1\n dp=[True]*(maxn)\n cnt=[0]*(maxn)\n ans=0\n for i in a:\n if dp[i]:\n cnt[i]+=1\n for j in range(i*2,maxn,i):\n dp[j]=False\n\n for i in a:\n if dp[i] and cnt[i]==1:\n #print(i)\n ans+=1\n print(ans)\n\nif __name__=="__main__":main()', 'import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10**6)\n\nN=int(input().rstrip())\na=[int(i) for i in input().split()]\nl=max(a)+1\ncnt=[0]*l\nfor i in a:\n for j in range(i,l,i):cnt[j]+=1\n\nans=0\nfor i in a:\n if cnt[i]==1:\n ans+=1\nprint(ans)'] | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s464719133', 's684877317', 's480151201'] | [137424.0, 153200.0, 31476.0] | [2208.0, 2211.0, 471.0] | [663, 508, 257] |
p02642 | u188827677 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\n\nans = 0\nfor i in range(n):\n for j in range(n):\n if a[i] != a[j]:\n if a[i]%a[j] == 0:\n ans += 1\n break\nprint(ans)', 'n = int(input())\na = sorted(list(map(int, input().split())))\n\nm = max(a)+1\ndp = [1]*m\nfor i in a:\n if dp[i-1] == 1:\n dp[i-1] = 2 \n for j in range(i*2, m, i):\n dp[j-1] = 0\n elif dp[i-1] == 2: \n dp[i-1] = 0\n\nprint(sum([1 for i in a if dp[i-1]])) '] | ['Wrong Answer', 'Accepted'] | ['s373924563', 's677763738'] | [32296.0, 32180.0] | [2206.0, 383.0] | [189, 459] |
p02642 | u193264896 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["import sys\nreadline = sys.stdin.buffer.readline\nfrom collections import Counter\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef main():\n N = int(readline())\n A = list(map(int, readline().split()))\n\n count = Counter(A)\n S = list(set(A))\n S.sort()\n max_A = max(A)\n a = int(max_A ** 0.5)\n\n bl = [True] *(max_A+1)\n\n for x in S:\n if x>a:\n break\n if bl[x] == False:\n continue\n t = x*2\n while t<=max_A:\n bl[t] = False\n t += x\n\n ans = 0\n for x in S:\n if count[x]==1 and bl[x]==True:\n ans += 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "import sys\nreadline = sys.stdin.buffer.readline\nfrom collections import Counter\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef main():\n N = int(readline())\n A = list(map(int, readline().split()))\n\n count = Counter(A)\n S = list(set(A))\n S.sort()\n max_A = max(A)\n\n bl = [True] *(max_A+1)\n\n for x in S:\n if bl[x] == False:\n continue\n t = x*2\n while t<=max_A:\n bl[t] = False\n t += x\n\n ans = 0\n for x in S:\n if count[x]==1 and bl[x]==True:\n ans += 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s925031437', 's122127414'] | [45384.0, 45164.0] | [245.0, 336.0] | [690, 630] |
p02642 | u193771328 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n n=int(input())\n a=sorted(map(int,input().split()))\n maxa=a[-1]+1\n tf=[False]*maxa\n r=0\n n-=1\n for i in range(n):\n a_i=a[i]\n if tf[a_i] ==False:\n for j in range(a_i,maxa,a_i):\n tf[j]=True\n if a_i <a[i+1]:\n #print(a_i)\n r+=1\n if tf[-1] ==False:\n #r+=1\n print(r)\nmain()\n', 'def main():\n n=int(input())\n a=sorted(map(int,input().split()))\n maxa=a[-1]+1\n tf=[False]*maxa\n r=0\n n-=1\n for i in range(n):\n a_i=a[i]\n if tf[a_i] ==False:\n for j in range(a_i,maxa,a_i):\n tf[j]=True\n if a_i <a[i+1]:\n #print(a_i)\n r+=1\n if tf[-1] ==False:\n r+=1\n print(r)\nmain()\n'] | ['Runtime Error', 'Accepted'] | ['s146705521', 's988832455'] | [8908.0, 32248.0] | [28.0, 210.0] | [330, 329] |
p02642 | u199290844 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\ndp = [True] * (10 ** 6 + 1)\ns = list(set(a))\nfor x in s:\n e = x * 2\n while e <= 10 ** 6:\n dp[e] = False\n e += x\nret = 0\nfor x in a:\n if c[x] == 1 and dp[x] == True:\n ret += 1\nprint(ans)\n', 'from collections import Counter\nn = int(input())\na = sorted(list(map(int, input().split())))\nc = Counter(a)\nmaxa = a[-1]+1\ndp = [True] * maxa\ns = list(set(a))\nfor x in s:\n for j in range(x*2,maxa,x):\n dp[j] = False\nret = 0\nfor x in a:\n if c[x] == 1 and dp[x] == True:\n ret += 1\nprint(ret)\n'] | ['Runtime Error', 'Accepted'] | ['s199244029', 's503559356'] | [52572.0, 51328.0] | [2172.0, 653.0] | [316, 309] |
p02642 | u206541745 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\na = list(map(int, input().strip().split()))\na.sort()\nlim=10**6+3\nans=0\nmultiples=[False]*lim\n\nfor i in range(n):\n if multiples[i]==True:\n continue\n if i!=n-1 and a[i]==a[i+1]:\n pass\n else:\n ans+=1\n\n for j in range(a[i],lim,a[i]):\n multiples[j]=True\nprint(ans)', 'n=int(input())\na = list(map(int, input().strip().split()))\na.sort()\nlim=10**6+1\nans=0\nmultiples=[False]*lim\n\nfor i in range(n):\n if multiples[a[i]]==True:\n continue\n elif i!=n-1 and a[i]==a[i+1]:\n pass\n else:\n ans+=1\n for j in range(a[i],lim,a[i]):\n multiples[j]=True\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s667927435', 's167188705'] | [32044.0, 32244.0] | [320.0, 332.0] | [314, 319] |
p02642 | u206890818 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\nimport math\nimport collections\nimport bisect\n#import sympy\n\n\ndef divisor(n):\n i = 1\n lower_divisors, upper_divisors = [], []\n while(i * i <= n):\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n // i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\nans = N\nSet = set()\nfor i in range(N):\n divs = divisor(A[i])\n print(divs)\n if i != 0:\n Set.add(A[i - 1])\n if i < N - 1:\n if A[i] == A[i + 1]:\n ans -= 1\n continue\n\n for d in divs:\n if i != 0:\n if d in Set:\n ans -= 1\n break\nprint(ans)\n', 'import numpy as np\nimport math\nimport collections\nimport bisect\n\n\ndef divisor(n):\n i = 1\n table = []\n while(i * i <= n):\n if n % i == 0:\n table.append(i)\n table.append(n // i)\n i += 1\n table = list(set(table))\n return table\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\nans = N\nfor i in range(N):\n divs = divisor(A[i])\n divs.sort()\n print(A[i], "divs", divs)\n if i < N - 1:\n if A[i] == A[i + 1]:\n ans -= 1\n continue\n\n for d in divs:\n if i != 0:\n #print(set(A[:i]), d)\n if d in set(A[:i]):\n ans -= 1\n break\nprint(ans)\n', 'import numpy as np\nimport math\nimport collections\nimport bisect\n\n\ndef divisor(n):\n i = 1\n table = []\n while(i * i <= n):\n if n % i == 0:\n table.append(i)\n table.append(n // i)\n i += 1\n table = list(set(table))\n return table\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\nans = N\nfor i in range(N):\n divs = divisor(A[i])\n divs.sort()\n print(A[i], "divs", divs)\n for d in divs:\n if i < N - 1:\n if A[i] == A[i + 1]:\n ans -= 1\n break\n if i != 0 and d != 1:\n tmp = bisect.bisect_left(A[:i], d)\n if len(A[:i]) <= tmp:\n break\n if A[:i][tmp] == d:\n ans -= 1\n break\nprint(ans)\n', 'import numpy as np\nimport math\nimport collections\nimport bisect\nfrom collections import Counter\n\n\nN = int(input())\n\nA = list(map(int, input().split()))\n\nA.sort()\nSet = set()\n\nAmax = A[len(A) - 1]\n\ncounter = Counter(A)\nans = 0\nfor a in A:\n if a in Set:\n continue\n x = a\n while(x <= Amax):\n Set.add(x)\n x += a\n\n if counter[a] == 1:\n ans += 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s561893628', 's627953188', 's941825450', 's939474581'] | [51440.0, 51496.0, 51476.0, 120048.0] | [2216.0, 2216.0, 2219.0, 869.0] | [778, 700, 792, 392] |
p02642 | u207850265 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['\n#include <algorithm>\n\n\nusing namespace std;\n\n\nint main(void) {\n int n;\n cin >> n;\n\n auto a = vector<int>(n);\n for (int i = 0; i < n; i++)\n {\n cin >> a[i];\n }\n sort(a.begin(), a.end());\n \n int cnt = 0;\n auto flags = vector<bool>(n, true);\n\n for (int i = 0; i < n; i++)\n {\n if (!flags[i])\n {\n continue;\n }\n \n if (i == n - 1 || a[i] != a[i + 1])\n {\n cnt += 1;\n }\n \n for (int j = i + 1; j < n; j++)\n {\n if (flags[j] && a[j] % a[i] == 0)\n {\n flags[j] = false;\n }\n }\n }\n \n cout << cnt << endl;\n \n return 0;\n}\n', 'from collections import Counter\n\n\nn = int(input())\na = list(map(int, input().split()))\na.sort()\nc = Counter(a)\n\nflags = [True] * (a[-1] + 1)\n\nfor e in a:\n for mul in range(2, a[-1] // e + 1):\n flags[e * mul] = False\n\nprint(sum([flags[a[i]] and c[a[i]] == 1 for i in range(n)]))\n'] | ['Runtime Error', 'Accepted'] | ['s093049636', 's196903916'] | [8960.0, 38308.0] | [24.0, 600.0] | [745, 288] |
p02642 | u209911545 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nL = list(map(int,input().split()))\nL.sort(reverse=True)\ncount = 0\nfor n in np.array(range(N)):\n print(f"N:{n}")\n if n != N-1:\n L_s = L[n+1:]\n else:\n L_s = L[n:]\n print(f"L_s:{L_s}")\n for l_s in L_s:\n print(l_s)\n if L[n]%l_s == 0:\n break\n else:\n count += 1\n\nprint(count)', 'import numpy as np\nN = int(input())\nL = list(map(int,input().split()))\nL.sort(reverse=True)\ncount = 0\nfor n in np.array(range(N)):\n if n != N-1:\n L_s = L[n+1:]\n else:\n L_s = L[n:]\n for l_s in L_s:\n if L[n]%l_s == 0:\n break\n else:\n count += 1\n\nprint(count)', 'n = int(input())\ndata = list(map(int, input().split()))\nmx = max(data)\nmarked = [0]*(mx + 1)\nfor a in data:\n for x in range(a, mx+1, a):\n marked[x] += 1\n print(marked)\nans = 0\nfor a in data:\n if marked[a] == 1:\n ans += 1\nprint(ans)', 'n = int(input())\ndata = list(map(int, input().split()))\nmx = max(data)\nmarked = [0]*(mx + 1)\nfor a in data:\n for x in range(a, mx+1, a):\n marked[x] += 1\nans = 0\nfor a in data:\n if marked[a] == 1:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s023906733', 's056570436', 's501826162', 's824573882'] | [32088.0, 51432.0, 142284.0, 32200.0] | [100.0, 2207.0, 2376.0, 446.0] | [350, 306, 258, 236] |
p02642 | u214515556 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def resolve():\n n = int(input())\n aaa = list(map(int, input().split()))\n aaa.sort()\n judge = [1] * len(aaa)\n for i in range(len(aaa) - 1):\n if judge[i]:\n for j in range(i + 1, len(aaa)):\n if aaa[j] % aaa[i] == 0:\n judge[j] = 0\n if aaa[i] == aaa[i + 1]:\n judge[i] = 0\n else:\n continue\n print(sum(judge))\n\n\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = """5\n24 11 8 3 16"""\n output = """3"""\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = """4\n5 5 5 5"""\n output = """0"""\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = """10\n33 18 45 28 8 19 89 86 2 4"""\n output = """5"""\n self.assertIO(input, output)\n\n\nif __name__ == "__main__":\n unittest.main()', 'from collections import Counter\nimport bisect\nN = int(input())\nA = list(map(int,input().split()))\ncnt = Counter(A)\nA.sort()\nans = 0\nMX = 10**6\nP = [0] * (MX+1)\nfor a in A:\n if P[a]==0:\n for i in range(MX+1):\n x = a*i\n if x > MX:\n break\n P[x] = 1\n if cnt[a]==1:\n ans+=1\nprint (ans)'] | ['Wrong Answer', 'Accepted'] | ['s299680581', 's819033935'] | [16736.0, 38652.0] | [71.0, 617.0] | [1273, 356] |
p02642 | u216015528 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\na_max = max(a)\nlst = [0] * (a_max + 1)\ncnt = 0\nfor i in a:\n if lst[i] > 1: \n continue\n lst[1::i] += 1\n \n # lst[i * j] += 1\nfor i in a:\n if lst[i] == 1:\n cnt += 1\nprint(cnt)', 'n = int(input())\na = list(map(int, input().split()))\ncnt = 0\nfor i in range(len(a)):\n for j in range(len(a)):\n if i <= j:\n break \n elif a[i] % a[j] == 0:\n break\n if j == len(a) - 1:\n cnt += 1\nprint(cnt)', 'n = int(input())\na = list(map(int, input().split()))\na_max = max(a)\nlst = [0] * (a_max + 1)\ncnt = 0\nfor i in a:\n if lst[i] > 1: \n continue\n for j in range(a_max // i + 1): \n lst[i * j] += 1\n lst[1::i] += 1\nfor i in a:\n if lst[i] == 1:\n cnt += 1\nprint(cnt)', 'n = int(input())\na = list(map(int, input().split()))\na_max = max(a)\nlst = [0] * (a_max + 1)\ncnt = 0\nfor i in a:\n if lst[i] > 1: \n continue\n for j in range(a_max // i + 1): \n lst[i * j] += 1\n # lst[1::i] += 1\nfor i in a:\n if lst[i] == 1:\n cnt += 1\nprint(cnt)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s080869439', 's923450971', 's989556898', 's993495707'] | [32188.0, 32240.0, 32184.0, 32180.0] | [84.0, 2206.0, 85.0, 486.0] | [422, 259, 418, 420] |
p02642 | u216928054 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nAS = [int(x) for x in input().split()]\n\nAS.sort()\n\nok = []\nfor i in range(N):\n for j in range(N):\n if AS[i] == AS[j]:\n break\n if i <= j:\n break\n if AS[i] % AS[j] == 0:\n break\n else:\n ok.append(i)\n\nprint(len(ok))\n', 'N = int(input())\nAS = [int(x) for x in input().split()]\n\nAS.sort(reverse=True)\nMAX_AS = AS[0]\ntable = [0] * (MAX_AS + 1) # 1..max(AS)\n\nalreadyVisited = {}\nfor i in range(N):\n x = dx = AS[i]\n if alreadyVisited.get(x, False):\n table[x] = 0\n continue\n alreadyVisited[x] = True\n\n table[x] = 1\n while True:\n x += dx\n if x > MAX_AS:\n break\n table[x] = 0\n\nprint(sum(table))\n'] | ['Wrong Answer', 'Accepted'] | ['s842923310', 's749506053'] | [32336.0, 43700.0] | [2206.0, 659.0] | [296, 429] |
p02642 | u217732870 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\nA = sorted(map(int, input().split()))\n\nB = [1 for _ in range(n)]\n\nfor i in range(n):\n if A[i]*2 > A[n-1] and A[i] <= A[n-1]:\n if i < n-1 and A[i] == A[i+1]:\n B[i] = 0\n B[i+1] = 0\n for j in range(n)[i+2:]:\n if A[j] == A[i]:\n B[j] = 0\n else:\n break\n else:\n break\n else:\n break\n \n c = 0\n if B[i] == 0:\n continue\n if i < n-1 and A[i] == A[i+1]:\n B[i] = 0\n B[i+1] = 0\n for j in range(n)[i+2:]:\n if A[j] == A[i]:\n B[j] = 0\n else:\n break\n while(A[i]*c <= A[n-1]):\n c += 1\n for j in range(n)[i+1:]:\n if A[j] == A[i]*c:\n B[j] = 0\nprint(sum(B))', 'from collections import Counter\nn = int(input())\nA = sorted(map(int, input().split()))\n\nc = Counter(A)\n\nyes_or_no = [1 for i in range(A[n-1])]\n\nfor a in A:\n t = a*2\n while t <= A[n-1]:\n yes_or_no[t] = 0\n t += a\nans = 0\nfor a in A:\n if c[a] == 1 and yes_or_no[a] == 1:\n ans += 1\nprint(ans)', 'from collections import Counter\nn = int(input())\nA = sorted(map(int, input().split()))\n\nc = Counter(A)\n\nyes_or_no = [True for i in range(A[n-1]+1)]\n\nfor a in A:\n t = a*2\n while t <= A[n-1]:\n yes_or_no[t] = False\n t += a\nans = 0\nfor a in A:\n if c[a] == 1 and yes_or_no[a] == True:\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s324140423', 's832617963', 's908929882'] | [32332.0, 42788.0, 42928.0] | [2206.0, 651.0, 729.0] | [679, 300, 312] |
p02642 | u219494936 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\n\nN = int(input())\nA = [int(x) for x in input().split(" ")]\nAmax = max(A)\ndp = np.ones(Amax, dtype=bool)\nappear = np.zeros(Amax, dtype=int)\nfor a in A:\n appear[a-1] += 1\n\nfor i in range(1, len(dp)+1):\n if not dp[i-1]:\n continue\n if appear[i-1] != 0:\n j = 2\n while j * i <= Amax:\n dp[j * i - 1] = False\n j += 1\n\ncount = 0\nfor a in A:\n if appear[a-1] > 1:\n continue\n else:\n count += dp[a-1]\nprint(count - len(dup_set))\n', 'import numpy as np\n\nN = int(input())\nA = [int(x) for x in input().split(" ")]\nAmax = max(A)\ndp = np.ones(Amax, dtype=bool)\nappear = np.zeros(Amax, dtype=int)\nfor a in A:\n appear[a-1] += 1\n\nfor i in range(1, (len(dp) + 1) // 2):\n if not dp[i-1]:\n continue\n if appear[i-1] != 0:\n j = 2\n while j * i <= Amax:\n dp[j * i - 1] = False\n j += 1\n\ncount = 0\nfor a in A:\n if appear[a-1] > 1:\n continue\n else:\n count += dp[a-1]\nprint(count)\n'] | ['Runtime Error', 'Accepted'] | ['s333612608', 's403125905'] | [51664.0, 51316.0] | [1155.0, 1133.0] | [466, 459] |
p02642 | u221272125 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int,input().split()))\nA.sort()\nd = {}\nn = A[-1]\ndef makePrimeChecker(n):\n isPrime = [True] * (n + 1)\n isPrime[0] = False\n isPrime[1] = False\n i = 0\n for j in A:\n if i == j:\n d[i] = 1\n i = j\n if i > 10**3:\n break\n if isPrime[i]:\n for j in range(i * i, n + 1, i):\n isPrime[j] = False\n return isPrime\nP = makePrimeChecker(n)\ni = 0\nans = 0\nfor j in A:\n if i == j:\n continue\n else:\n i = j\n if P[i]:\n if d[i] == 0:\n ans += 1\nprint(ans)', 'N = int(input())\nA = list(input().split())\nA.sort()\nd = []\nans = 0\nwhile A:\n a = A.pop(0)\n f = 0\n for p in d:\n if a % p == 0:\n f = 1\n break\n else:\n d.append(a)\n if f == 0:\n if a ==A[0]:\n while a == A[0]:\n A.pop(0)\n else:\n ans += 1\nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\nA.sort()\nd = {}\nn = A[-1]\ndef makePrimeChecker(n):\n isPrime = [True] * (n + 1)\n isPrime[0] = False\n isPrime[1] = False\n i = 0\n for j in A:\n if i == j:\n isPrime[i] = False\n i = j\n if i > 10**3:\n break\n if isPrime[i]:\n for j in range(i * i, n + 1, i):\n isPrime[j] = False\n return isPrime\nP = makePrimeChecker(n)\ni = 0\nans = 0\nfor j in A:\n if i == j:\n continue\n else:\n i = j\n if P[i]:\n ans += 1\nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\nA.sort()\nd = {}\ndef makePrimeChecker(n):\n isPrime = [True] * (n + 1)\n isPrime[0] = False\n isPrime[1] = False\n for j in A:\n if i == j:\n d[i] = 1\n i = j\n if i > 10**3:\n break\n if isPrime[i]:\n for j in range(i * i, n + 1, i):\n isPrime[j] = False\n return isPrime\nP = makePrimeChecker(n)\ni = 0\nans = 0\nfor j in A:\n if i == j:\n continue\n else:\n i = j\n if P[i]:\n if d[i] == 0:\n ans += 1\nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\nA.sort()\nd = {}\nn = A[-1]\ndef makePrimeChecker(n):\n isPrime = [True] * (n + 1)\n isPrime[0] = False\n isPrime[1] = False\n for i in A:\n if i > 10**3:\n break\n if isPrime[i]:\n for j in range(i * i, n + 1, i):\n isPrime[j] = False\n return isPrime\nP = makePrimeChecker(n)\ni = 0\nans = 0\nfor j in A:\n if i == j:\n continue\n else:\n i = j\n if P[i]:\n if A.count(i) == 1:\n ans += 1\nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\nA.sort()\nd = {}\nn = A[-1]\ndef makePrimeChecker(n):\n isPrime = [True] * (n + 1)\n i = 0\n for j in A:\n if i == j:\n isPrime[i] = False\n continue\n i = j\n if isPrime[i]:\n for j in range(i * 2, n + 1, i):\n isPrime[j] = False\n return isPrime\nP = makePrimeChecker(n)\ni = 0\nans = 0\nfor j in A:\n if i == j:\n continue\n else:\n i = j\n if P[i]:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s011420583', 's149141099', 's339840959', 's553688449', 's949648056', 's857165352'] | [33228.0, 25296.0, 33416.0, 33224.0, 32372.0, 32376.0] | [145.0, 2206.0, 208.0, 107.0, 2206.0, 299.0] | [606, 351, 586, 586, 548, 521] |
p02642 | u228232845 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\n\n\nn = I()\na = LI()\n\ncnt = [0] * ((10 ** 6) + 1)\nunique = []\n\nfor i in range((10 ** 6) + 1):\n if cnt[i] == 1:\n unique.append(i)\n\n\na = list(set(a)) \ncnt = [0] * (10 ** 6 + 1) \n\n\nfor ele in a:\n \n for m in range(ele * 2, (10 ** 6) + 1, ele):\n cnt[m] = 1\n\nans = 0\n\nfor ele in unique:\n if cnt[ele] == 0:\n ans += 1\n\nprint(ans)\n', 'import sys\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\n\n\nn = I()\na = LI()\ncnt = [0] * ((10 ** 6) + 1)\nunique = []\n\nfor i in range((10 ** 6) + 1):\n if cnt[i] == 1:\n unique.append(i)\n\n\na = list(set(a))\ncnt = [0] * (10 ** 6 + 1)\n\nfor ele in a:\n for m in range(ele * 2, (10 ** 6) + 1, ele):\n cnt[m] = 1\n\nans = 0\n\nfor ele in unique:\n if cnt[ele] == 0:\n ans += 1\n\nprint(ans)\n', '\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\n\n\nn = I()\na = LI()\ncnt = [0] * ((10 ** 6) + 1)\nfor elem in a:\n cnt[elem] += 1\n\nunique = []\n\nfor i in range((10 ** 6) + 1):\n if cnt[i] == 1:\n unique.append(i)\n\ncnt = [0] * ((10 ** 6) + 1)\n\na = list(set(a))\n\nfor elem in a:\n for m in range(elem * 2, (10 ** 6) + 1, elem):\n cnt[m] = 1\n\nans = 0\n\nfor elem in unique:\n if cnt[elem] == 0:\n ans += 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s142440669', 's303370556', 's210919988'] | [41568.0, 39880.0, 47528.0] | [1634.0, 1504.0, 1600.0] | [751, 484, 465] |
p02642 | u228303592 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\n\ndef main():\n N = int(input())\n A = list(map(int,input().split()))\n A.sort()\n d = np.zeros(A[-1]+1, dtype=np.uint64)\n \n for i in range(N):\n a = A[i]\n a1 = A[i-1]\n if a != a1:\n d[a::a] += 1\n else:\n d[a] += 1\n print(np.count_nonzero(d[A] == 1))\n \nprint(main())', 'import numpy as np\n\ndef main():\n N = int(input())\n A = list(map(int,input().split()))\n A.sort()\n d = np.zeros(A[-1]+1, dtype=np.unit64)\n \n for i in range(N):\n a = A[i]\n a1 = A[i-1]\n if a != a1:\n d[a::a] += 1\n else:\n d[a] += 1\n print(np.count_nonzero(d[A] == 1))\n \nmain()\n', 'import numpy as np\n\ndef main():\n N = int(input())\n A = list(map(int,input().split()))\n A.sort()\n d = np.zeros(A[-1]+1, dtype=np.unit64)\n \n for i in range(N):\n a = A[i]\n a1 = A[i-1]\n if a != a1:\n if a != a1:\n d[a::a] += 1\n else:\n d[a] += 1\n print(np.count_nonzero(d[A] == 1))\n \nprint(main())', 'import numpy as np\n\ndef main():\n N = int(input())\n A = list(map(int,input().split()))\n A.sort()\n d = np.zeros(A[-1]+1, dtype=np.unit64)\n \n for i in range(N):\n a = A[i]\n a1 = A[i-1]\n if a != a1:\n d[a::a] += 1\n else:\n d[a] += 1\n print(np.count_nonzero(d[A] == 1))\n \nprint(main())\n', 'import numpy as np\n\ndef main():\n N = int(input())\n A = list(map(int,input().split()))\n A.sort()\n d = np.zeros(A[-1]+1, dtype=np.unit64)\n \n for i in range(N):\n a = A[i]\n a1 = A[i-1]\n if a != a1:\n if a != a1:\n d[a::a] += 1\n else:\n d[a] += 1\n print(np.count_nonzero(d[A] == 1))\n \nmain()\n', 'import numpy as np\n\ndef main():\n N = int(input())\n A = list(map(int,input().split()))\n A.sort()\n d = np.zeros(A[-1]+1, dtype=np.uint64)\n \n for i in range(N):\n a = A[i]\n a1 = A[i-1]\n if a != a1:\n d[a::a] += 1\n else:\n d[a] += 1\n print(np.count_nonzero(d[A] == 1))\n \nmain()'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s036607686', 's139126637', 's372782415', 's376124430', 's732184550', 's595726781'] | [51604.0, 9044.0, 51332.0, 51644.0, 51600.0, 51472.0] | [680.0, 24.0, 195.0, 191.0, 193.0, 647.0] | [307, 307, 331, 308, 325, 300] |
p02642 | u233107306 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n n = int(input())\n a = list(map(int, input().split()))\n a = sorted(a)\n\n max_a = a[-1]\n dp = [True] * max_a\n\n for i in a:\n x = 1\n while i * x <= max_a:\n dp[i * x] = False\n x += 1\n\n ans = 0\n for i in a:\n if dp[i]:\n ans += 1\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'def main():\n n = int(input())\n a = list(map(int, input().split()))\n a = sorted(a)\n\n max_a = max(a) + 1\n dp = [True] * max_a\n\n for idx in range(len(a)):\n if idx + 1 != len(a) and a[idx] == a[idx + 1]:\n dp[a[idx]] = False\n i = a[idx]\n x = 2\n while i * x < max_a:\n dp[i * x] = False\n x += 1\n\n ans = 0\n for i in a:\n if dp[i]:\n ans += 1\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s277564122', 's760986052'] | [32108.0, 32380.0] | [417.0, 492.0] | [367, 490] |
p02642 | u238084414 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import math\n\ndef isPrime(n):\n if n == 1:\n return False\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n return True\n\ndef isDiv(x, y):\n if x % y == 0:\n return True\n else:\n return False\n\nN = int(input())\nA = sorted(list(map(int, input().split())))\ncnt = N\n\nif len(A) == 1:\n print(N)\n exit()\n\nif A[0] == 1 and A[1] == 1:\n print(N)\n exit()\nif A[0] == 1 and A[1] != 1:\n print(N - 1)\n exit()\n\nfor i in range(N):\n x = A[i]\n if isPrime(x):\n if i - 1 >= 0:\n x == A[i - 1]\n cnt -= 1\n continue\n if i + 1 < N:\n x = A[i + 1]\n cnt -= 1\n continue\n continue\n \n for j in range(i):\n y = A[j]\n if isDiv(x, y):\n cnt -= 1\n break\nprint(cnt)\n', 'import math\n\ndef isPrime(n):\n if n == 1:\n return False\n for k in range(2, int(math.sqrt(n)) + 1):\n if n % k == 0:\n return False\n return True\n\nN = int(input())\nA = sorted(list(map(int, input().split())))\ncnt = N\n\nif N == 1:\n print(1)\n exit()\n\nif A[0] == 1 and A[1] == 1:\n print(0)\n exit()\nif A[0] == 1 and A[1] != 1:\n print(1)\n exit()\n\nfor i in range(N):\n x = A[i]\n if isPrime(x):\n if i - 1 >= 0:\n if x == A[i - 1]:\n cnt -= 1\n continue\n if i + 1 < N:\n if x == A[i + 1]:\n cnt -= 1\n continue\n continue\n \n for j in range(i + 1):\n if j == N:\n break\n y = A[j]\n if x % y == 0:\n cnt -= 1\n break\nprint(cnt)\n', 'N = int(input())\nA = sorted(list(map(int, input().split())))\nm = A[-1]\nB = [0] * m\nfor a in A:\n B[a - 1] += 1\n if B[a - 1] == 1:\n for j in range(a * 2, m + 1, a):\n B[j - 1] = 2\nprint(B.count(1))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s168460191', 's278613961', 's996456917'] | [33204.0, 32564.0, 32384.0] | [2206.0, 2206.0, 357.0] | [733, 695, 204] |
p02642 | u242580186 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["import sys\nread = sys.stdin.readline\nimport time\nimport math\nimport itertools as it\ndef inp():\n return int(input())\ndef inpl():\n return list(map(int, input().split()))\nst = time.perf_counter()\n# ------------------------------\n\nN = inp()\nA = inpl()\nA.sort()\ndp = [False] * 1001001\nnt = -1\nfor i in A:\n if i != nt:\n dp[i] = True\n else:\n dp[i] = False\n nt = i\n\nans = 0\nmx = A[N-1]\nfor i in A:\n if dp[i]:\n ans += 1\n j = i\n while j <= 1001001:\n dp[j] = False\n j += i\nprint(ans)\n\n# -----------------------------\ned = time.perf_counter()\nprint('time:', ed-st, file=sys.stderr)\n", "import sys\nread = sys.stdin.readline\nimport time\nimport math\nimport itertools as it\ndef inp():\n return int(input())\ndef inpl():\n return list(map(int, input().split()))\nstart_time = time.perf_counter()\n# ------------------------------\n\nN = inp()\nA = inpl()\nA.sort()\ndp = [False] * 1001001\nnt = -1\n\nfor i in A:\n if i != nt:\n dp[i] = True\n else:\n dp[i] = False\n nt = i\n\nans = 0\nmx = A[N-1]\nnt = -1\nfor i in A:\n if dp[i]:\n ans += 1\n if i == nt:\n continue\n nt = i\n j = i\n while j <= mx:\n dp[j] = False\n j += i\n\nprint(ans)\n\n# -----------------------------\nend_time = time.perf_counter()\nprint('time:', end_time-start_time, file=sys.stderr)"] | ['Runtime Error', 'Accepted'] | ['s738956146', 's283776841'] | [33012.0, 32296.0] | [320.0, 562.0] | [645, 705] |
p02642 | u243714267 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\nli = [1]*(10**6+5)\na.sort()\nans = 1\n\nfor i in range(a[0], len(li), a[0]):\n li[i] = [0]\n\nflag = False\nfor i in range(1, len(a)):\n if a[i-1] == a[i]:\n flag = True\n continue\n else:\n flag = False\n ans -= 1\n if li[a[i]] == 1:\n ans += 1\n for j in range(a[i], len(li), a[i]):\n li[j] = 0\nif flag:\n ans -= 1\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\nli = [1]*(10**6+5)\na.sort()\nans = 1\n \nfor i in range(a[0], len(li), a[0]):\n li[i] = [0]\n \nflag = False\nflag2 = True\nfor i in range(1, len(a)):\n if a[i-1] == a[i]:\n flag = True\n continue\n else:\n if flag and flag2:\n ans -= 1\n flag = False\n if li[a[i]] == 1:\n flag2 = True\n ans += 1\n for j in range(a[i], len(li), a[i]):\n li[j] = 0\n else:\n flag2 = False\nif flag and flag2:\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s959586981', 's358736835'] | [104616.0, 104496.0] | [736.0, 686.0] | [390, 483] |
p02642 | u244416763 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int,input().split()))\nr = [0 for _ in range(max(a)+1)]\nl = [1 for _ in range(max(a)+1)]\nans = 0\nfor i in a:\n r[i] += 1\nfor i in range(len(r)):\n if r[i]:\n for j in range(2*i,len(r),i):\n if 1 < r[j]:\n break\n elif (r[j] == 1 and l[j]):\n ans += 1\n l[j] = 0\nprint(ans)', 'n = int(input())\na = list(map(int,input().split()))\nr = [0 for _ in range(max(a)+1)]\nl = [0 for _ in range(max(a)+1)]\nans = n\nfor i in a:\n r[i] += 1\n l[i] = 1\nfor i in range(len(r)):\n if r[i]:\n if 1 < r[i]:\n l[i] = 0\n for j in range(2*i,len(r),i):\n if r[j]:\n l[j] = 0\nprint(sum(l))'] | ['Wrong Answer', 'Accepted'] | ['s567192101', 's309219176'] | [35284.0, 35032.0] | [591.0, 627.0] | [373, 341] |
p02642 | u253011685 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['X,N = map(int, input().split())\nif N==0:\n print(X)\nelse:\n p=list(map(int,input().split()))\n A=[i for i in range(100) if i not in p]\n\nmini=101\nminip=101\nfor i in range(N):\n if abs(p[i]-X) <=mini:\n mini= abs(p[i]-X)\n minip=p[i]\n \n\nminimini=101\nanswer=101\nfor a in A:\n if abs(a-minip)<minimini:\n minimini=abs(a-minip)\n answer=a\n\nprint(answer)', 'N= int(input())\nA=list(map(int,input().split()))\n\ndp=[0]*(max(A)+1)\n\nfor a in A:\n for x in range(a,len(dp),a):\n dp[x]+=1\n\ncount=0\nfor a in A:\n if dp[a]==1:\n count+=1\n\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s882954923', 's263266299'] | [9236.0, 32252.0] | [24.0, 483.0] | [389, 199] |
p02642 | u263660661 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = sorted(list(map(int, input().split())))\n\ncnt = 1\nfor i in range(N):\n for j in range(i):\n print(i, j)\n if A[i] % A[j] == 0:\n break\n elif j == i - 1:\n cnt += 1\n\nprint(cnt)\n', 'N = int(input())\nA = list(map(int, input().split()))\n\ncnt = N\nfor i in range(N//2):\n for j in range(i+1, N):\n if i != j and A[i] % A[j] == 0:\n cnt -= 1\n if A[j] % A[i] == 0:\n cnt -= 1\n break\n if i != j and A[j] % A[i] == 0:\n cnt -= 1\n break\n\nprint(cnt)\n', 'N = int(input())\nA = sorted(list(map(int, input().split())))\nAmax = max(A)\n\nans = [False] * (Amax + 1)\nfor x in A:\n for j in range(x, Amax + 1, x):\n ans[j] += 1\n\nprint(sum(ans[i] == 1 for i in A))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s406823810', 's730911814', 's003257029'] | [40964.0, 33100.0, 32252.0] | [2266.0, 2206.0, 472.0] | [237, 340, 207] |
p02642 | u263753244 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\na=list(map(int,input().split()))\na.sort()\nM=max(a)\np=[]\nfor i in range(n):\n if i+1<=n-1:\n if a[i]==a[i+1]:\n p+=[j for j in range(a[i],M+1,a[i])]\n else:\n p+=[j for j in range(a[i]*2,M+1,a[i])]\n\nprint(len(set(set(a)-set(p))))', 'import math\nimport sys\nn=int(input())\na=list(map(int,input().split()))\na.sort()\nM=max(a)\np=[]\n\nfor i in range(n):\n p.append([j for j in range(a[i],M+1,a[i])])\nprint(len(set(set(a)-set(p))))', 'n=int(input())\na=list(map(int,input().split()))\na.sort()\nM=max(a)\np=[]\nfor i in range(n):\n if i+1<=n-1:\n if a[i]==a[i+1]:\n p+=[j for j in range(a[i],M+1,a[i])]\n else:\n p+=[j for j in range(a[i]*2,M+1,a[i])]\n else:\n p+=[j for j in range(a[i]*2,M+1,a[i])]\n\nprint(len(set(set(a)-set(p))))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s145563940', 's440752143', 's232230371'] | [66092.0, 153236.0, 192024.0] | [368.0, 526.0, 638.0] | [269, 192, 334] |
p02642 | u264395947 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import math\n\nN = int(input())\nA = sorted(list(set(map(int, input().split()))))\nans = 0\n\nif len(A) > 1:\n for i in range(len(A)):\n for j in range(i+1):\n if A[j] > math.sqrt(A[i]):\n ans += 1\n break\n if A[i] % A[j] == 0:\n if j != i:\n break\n else:\n ans += 1\n\nprint(ans)', 'import math\nimport random\n\ndef is_prime(q,k=50):\n q = abs(q)\n if q == 2: return True\n if q < 2 or q&1 == 0: return False\n\n d = (q-1)>>1\n while d&1 == 0:\n d >>= 1\n \n for i in range(k):\n a = random.randint(1,q-1)\n t = d\n y = pow(a,t,q)\n while t != q-1 and y != 1 and y != q-1: \n y = pow(y,2,q)\n t <<= 1\n if y != q-1 and t&1 == 0:\n return False\n return True\n\nN = int(input())\nA = sorted(list(set(map(int, input().split()))))\n\nans = 0\n\nif len(A) > 1:\n for i in range(len(A)):\n if is_prime(A[i]):\n ans += 1\n continue\n for j in range(i+1):\n if A[j] > math.sqrt(A[i]):\n ans += 1\n break\n if A[i] % A[j] == 0:\n if j != i:\n break\n else:\n ans += 1\n\nprint(ans)', 'N = int(input())\nA = sorted(list(map(int, input().split())))\n\ndp = [True]*(A[-1]+1)\n\nans = 0\n\nfor i in range(len(A)):\n if dp[A[i]]:\n if (i == len(A)-1) or (A[i] != A[i+1]):\n ans += 1\n try:\n k = 1\n while(True):\n dp[k*A[i]] = False\n k += 1\n except:\n pass\n\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s190058472', 's744174328', 's999134762'] | [41552.0, 42988.0, 32252.0] | [2206.0, 2206.0, 647.0] | [378, 890, 334] |
p02642 | u271469978 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\nMAX = max(A)\ndp = [True for _ in range(MAX+1)]\n\nfor a in set(A):\n for k in range(2*a,MAX+1,a):\n dp[k] = False\nB = sorted(A)\nfor i in range(len(B)-1):\n if B[i] == B[i+1]:\n dp[B[i]] = False\n\nprint(sum(dp[a] for a in set(A)))\nprint(dp)', 'N = int(input())\nA = list(map(int, input().split()))\nMAX = max(A)\ndp = [True for _ in range(MAX+1)]\n\nfor a in set(A):\n for k in range(2*a,MAX+1,a):\n dp[k] = False\nB = sorted(A)\nfor i in range(len(B)-1):\n if B[i] == B[i+1]:\n dp[B[i]] = False\n\nprint(sum(dp[a] for a in set(A)))'] | ['Wrong Answer', 'Accepted'] | ['s132536937', 's107513766'] | [45024.0, 41992.0] | [477.0, 441.0] | [305, 295] |
p02642 | u277236383 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import bisect\nn = int(input())\na = list(map(int, input().split()))\na.sort()\nans = 0\nfor i in range(n):\n if a[i] != 0:\n if i == n-1:\n ans +=1\n else: \n if a[i] == a[i+1]:\n for j in range(i+1, n):\n if a[j]%a[i]==0:\n a[j]=0\n else:\n ans += 1\n for j in range(bisect.bisect_left(a, 2*a[i]), n):\n if a[j]%a[i]==0:\n a[j]=0\n \n \nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\ndp = [0]*a[n-1]\nans = 0\ntemp2 = 0\nfor i in range(n):\n if temp2 == a[i]:\n ans -= 1\n temp2=0\n if dp[a[i]-1] == 0:\n ans += 1\n temp = a[i]\n temp2 = a[i]\n while temp <= a[n-1]:\n dp[temp-1] = 1\n temp = temp+a[i]\n #print(dp) \nprint(ans) '] | ['Wrong Answer', 'Accepted'] | ['s445996337', 's341336049'] | [32300.0, 33096.0] | [2206.0, 697.0] | [421, 330] |
p02642 | u277556971 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\ninput = sys.stdin.readline\nimport math\nfrom collections import defaultdict\n\nn = map(int, input())\na = list(map(int, input().split()))\nN = 1000005\nb = [0] * N\n\nd = defaultdict(int)\nfor x in a:\n d[x] += 1\n\nfor x in d:\n for j in list(range(2, N)):\n if x * j >= N || b[x * j] == 1: \n break\n else:\n b[x * j] = 1\n\nans = 0\nfor x in a:\n if b[x] == 1:\n continue\n else:\n if d[x] >= 2:\n continue\n else:\n ans += 1\nprint(ans)\n', '#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n#define F first\n#define S second\n\n\n\n\n\n#define all(v) v.begin(), v.end()\n\n\n\n\nconst int inf = 1000000007;\nconst ll INF = 1e18;\nint mod = 998244353;\n// int mod = 1000000007;\n#define abs(x) (x >= 0 ? x : -(x))\n#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())\n#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())\ntemplate<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }\ntemplate<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }\nll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }\nll lcm(ll a, ll b) { return a / gcd(a, b) * b; }\ntemplate<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }\nll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }\ntemplate<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }\ntemplate<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }\ntemplate<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }\ntemplate<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }\ntemplate<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }\n\nvoid solve();\n\nint main() {\n ios::sync_with_stdio(false);\n cin.tie(0);\n cout.tie(0);\n cout << fixed << setprecision(11);\n int T;\n T = 1;\n while (T--) solve();\n}\n\nvoid solve() {\n int n;\n cin >> n;\n vector<int> a(n);\n cin >> a;\n\n const int N = 1000005;\n vector<int> b(N);\n\n for (int x : a) {\n if (b[x] == 0) {\n for (int y = 2 * x; y < N; y += x) b[y]++;\n }\n b[x]++;\n }\n int ans = 0;\n for (int x : a) if (b[x] == 1) ans++;\n cout << ans << endl;\n}\n', 'import sys\ninput = sys.stdin.readline\nimport math\n\nn = map(int, input())\na = list(map(int, input().split()))\nN = 1000005\nb = [0] * N\n\nfor x in a:\n if b[x] == 0:\n for y in list(range(2 * x, N, x)):\n b[y] += 1\n b[x] += 1\n\nans = 0\nfor x in a:\n if b[x] == 1:\n ans += 1\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s393812104', 's592057572', 's417065653'] | [8852.0, 8956.0, 64976.0] | [24.0, 31.0, 612.0] | [523, 2267, 310] |
p02642 | u285022453 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["x, n = map(int, input().split())\np = list(map(int, input().split()))\n\np_all = set(range(0, 102)) - set(p)\n# print(p_all)\n\nmi = float('inf')\nans = 0\nfor i in p_all:\n if abs(x - i) < mi:\n mi = abs(x - i)\n ans = i\n\nprint(ans)\n", 'import sys\nimport math\n\nn = int(input())\na = list(map(int, input().split()))\na.sort()\nlimit = max(a)\ndp = [True] * (limit + 1)\narchives = set()\nfor i in a:\n if i in archives:\n dp[i] = False\n continue\n archives.add(i)\n n = 2\n while i * n <= limit:\n dp[i * n] = False\n n += 1\n\n# print(dp)\nans = 0\nfor i in a:\n if dp[i] is True:\n ans += 1\n\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s444532593', 's709992719'] | [9116.0, 40232.0] | [28.0, 767.0] | [240, 398] |
p02642 | u291988695 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\nl=list(map(int,input().split()))\nl.sort()\nans=0\nfor i in range(n):\n flag=True\n s=l[-1-i]\n for j in range(n):\n if n-1-i==j:\n pass\n else:\n if s%l[j]==0:\n flag=False\n break\n if flag:\n ans+=1', 'n=int(input())\nl=list(map(int,input().split()))\nl.sort()\np=[1]*(l[-1]+1)\nans=0\nfor i in range(n):\n a=l[i]\n if p[a]==1:\n b=a\n while a<=l[-1]:\n p[a]=0\n a+=b\n if i<n-1:\n if l[i]==l[i+1]:\n pass\n else:\n ans+=1\n else:\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s867485012', 's778643015'] | [32384.0, 32168.0] | [2206.0, 624.0] | [239, 283] |
p02642 | u294385082 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\n\nn = int(input())\na = list(map(int,input().split()))\na.sort()\nA = list(set(a))\nA.sort()\n\ndef nd():\n ans = 0\n l = [1 for _ in range(len(A))]\n print(l)\n ind = 0\n i = A[ind]\n \n while i <= A[-1]//2:\n if l[A.index(i)] == 1:\n j = 2 * i\n while j <= A[-1]:\n if j in set(A):\n l[A.index(j)] = 0\n j += i\n ind += 1\n i = A[ind]\n \n table = [A[i] for i in range(len(A)) if l[i] == 1]\n ans = len(table)\n \n dic = Counter(a)\n \n for k,v in dic.items():\n if v >= 2:\n ans -= 1\n \n return ans\n \nprint(nd())', 'from collections import Counter\n\nn = int(input())\na = list(map(int,input().split()))\nA = list(set(a))\nA.sort()\namax = A[-1]\nsieve = [1]*(amax+1)\nans = []\n\nfor i in A:\n for j in range(2,amax//i + 1):\n sieve[i*j] = 0\n\nfor i in A:\n if sieve[i] == 1:\n ans.append(i)\n\nc = Counter(a)\nansl =len(ans)\n\nfor k,v in c.items():\n if sieve[k] == 1 and v >= 2:\n ansl -= 1\n \nprint(ansl)\n'] | ['Wrong Answer', 'Accepted'] | ['s599355079', 's906669360'] | [42700.0, 48816.0] | [2207.0, 545.0] | [644, 386] |
p02642 | u303739137 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\nn = int(input())\naa = list(map(int, input().split()))\naa.sort()\n\nfrom collections import Counter\ndic = Counter(aa)\ntimes = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]\n\naa = list(set(aa) - set(times))\noks = np.ones(len(aa))\nfor i in range(len(aa)):\n for j in range(i+1,len(aa)):\n if (aa[j]%aa[i] == 0):\n oks[j] = 0\nprint(int(oks.sum()))', 'import numpy as np\nfrom collections import Counter\nn = int(input())\naa = list(map(int, input().split()))\nngs = np.zeros((10**6)+1, dtype=int)\n\nfor a in set(aa):\n ngs[2*a::a] = 1\n \ndic = Counter(aa)\ntimes = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]\n\nfor i in times:\n ngs[i] = 1\ncnt = 0\nfor a in aa:\n cnt += 1-ngs[a]\nprint((cnt))'] | ['Wrong Answer', 'Accepted'] | ['s547331588', 's660872926'] | [69200.0, 63152.0] | [2208.0, 481.0] | [392, 358] |
p02642 | u307622233 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["import sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n A = [int(i) for i in input().split()]\n\n # MOD = 10 ** 9 + 7\n A.sort()\n s = set()\n\n ans = 0\n if A[0] != A[1]:\n ans += 1\n\n for i in range(1, n):\n if A[i - 1] == A[i]:\n continue\n\n for j in range(i):\n if j in s:\n continue\n elif A[i] % A[j] == 0:\n s.add(i)\n break\n else:\n ans += 1\n \n\n print(ans)\n\n\nif __name__ == '__ma", "def main():\n n = int(input())\n A = [int(i) for i in input().split()]\n\n max_dp = max(A) + 1\n dp = [0] * max_dp\n\n for a in A:\n if dp[a] >= 2:\n continue\n dp[a] += 1\n for i in range(a << 1, max_dp, a):\n dp += 2\n print(np.sum(dp == 1))\n\n\nif __name__ == '__main__':\n main()", 'import numpy as np\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n A = [int(i) for i in input().split()]\n\n max_dp = max(A) + 1\n dp = np.zeros(max_dp, dtype="int32")\n\n for a in A:\n if dp[a] >= 2:\n continue\n dp[np.arange(a, max_dp, a)] += 2\n dp[a] -= 1\n\n print(np.sum(dp == 1))\n', 'import numpy as np\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n A = np.array([int(i) for i in input().split()])\n\n max_dp = np.max(A) + 1\n dp = np.zeros(max_dp, dtype="int32")\n\n for a in A:\n if dp[a] >= 2:\n continue\n fancy = np.arange(a, max_dp, a)\n dp[fancy] += 2\n dp[a] -= 1\n\n\nif __name__ == \'__main__\':\n main()', "import sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n A = [int(i) for i in input().split()]\n ans = 1\n A.sort()\n A = dq(A)\n\n print(type(A))\n\n while A:\n start = A.popleft()\n if not A:\n break\n ans += 1\n A = dq([a for a in A if a % start != 0])\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", 'import numpy as np\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n A = [int(i) for i in input().split()]\n\n max_dp = np.max(A) + 1\n dp = np.zeros(max_dp, dtype="int32")\n\n for a in A:\n if dp[a] >= 2:\n continue\n dp[np.arange(a, max_dp, a)] += 2\n dp[a] -= 1\n\n print(np.sum(dp == 1))\n', "\ndef main():\n n = int(input())\n A = [int(i) for i in input().split()]\n\n max_dp = max(A) + 1\n dp = [0] * max_dp\n\n\n for a in A:\n if dp[a] >= 2:\n continue\n dp[a] += 1\n for i in range(a << 1, max_dp, a):\n dp[i] += 2\n print(dp.count(1))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s064561961', 's164087956', 's284569106', 's533604671', 's568716157', 's680928413', 's113337831'] | [9076.0, 32132.0, 27172.0, 51536.0, 31308.0, 27172.0, 32164.0] | [24.0, 130.0, 106.0, 1532.0, 102.0, 109.0, 266.0] | [575, 331, 349, 395, 374, 352, 333] |
p02642 | u312025627 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["from numba import njit, int32\nimport numpy as np\n\n\n@njit(int32(int32[:], int32[:]))\ndef main(A, B):\n ans = 0\n\n for a in A:\n B[a] += 1\n\n for a in set(A):\n v = 2*a\n while v <= 10**6:\n B[v] += 1\n v += a\n\n for a in A:\n if B[a] == 1:\n ans += 1\n\n return ans\n\n\nif __name__ == '__main__':\n N = int(input())\n A = [int(i) for i in input().split()]\n B = [0]*(10**6+1)\n ans = main(np.array(A), np.array(B))\n print(ans)\n", "from numba import njit, int32\nimport numpy as np\n\n\n@njit(int32(int32[:], int32[:], int32[:]))\ndef main(A, B, C):\n ans = 0\n\n for a in A:\n B[a] += 1\n\n for a in C:\n v = 2*a\n while v <= 10**6:\n B[v] += 1\n v += a\n\n for a in A:\n if B[a] == 1:\n ans += 1\n\n return ans\n\n\nif __name__ == '__main__':\n N = int(input())\n A = [int(i) for i in input().split()]\n B = [0]*(10**6+1)\n ans = main(np.array(A, dtype=np.int32),\n np.array(B, dtype=np.int32),\n np.array([a for a in set(A)], dtype=np.int32))\n print(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s559222539', 's639620703'] | [139496.0, 143952.0] | [902.0, 788.0] | [498, 615] |
p02642 | u312158169 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = [int(x) for x in input().split()]\n\na.sort()\n\nif n == 1:\n print(1)\n exit()\n\nans = [1] * (a[n-1]+1)\n\nfor i in range(n):\n if i >= 1 and a[i] == a[i-1]:\n ans[a[i]] = 0\n\n else:\n j = 2\n while j*a[i] <= a[n-1]:\n ans[j*a[i]] = 0\n j += 1\n\n\nsum = 0\n\nprint(sum)\n', 'n = int(input())\na = [int(x) for x in input().split()]\n\na.sort()\n\nif n == 1:\n print(1)\n exit()\n\nans = [1] * (a[n-1]+1)\n\nfor i in range(n):\n if i >= 1 and a[i] == a[i-1]:\n ans[a[i]] = 0\n\n else:\n j = 2\n while j*a[i] <= a[n-1]:\n ans[j*a[i]] = 0\n j += 1\n\n\nsum = 0\n\nfor i in range(n):\n sum += ans[a[i]]\n\n\nprint(sum)\n'] | ['Wrong Answer', 'Accepted'] | ['s274732993', 's467267711'] | [32108.0, 32168.0] | [905.0, 935.0] | [327, 369] |
p02642 | u312695001 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n\n N = int(input())\n A = list(map(int, input().split()))\n\n A = sorted(A)\n Amax = A[-1]\n count = [0 for _ in range(Amax+1)]\n\n for a in A:\n for i in range(1, Amax//a+1):\n count[i*a] += 1\n\n ans = 0\n for i in range(N):\n a = A[i]\n if count[a] == 1:\n print(i)\n ans += 1\n# print(count) \n print(ans)\n\nif __name__ == "__main__":\n main()\n\n', 'def main():\n\n N = int(input())\n A = list(map(int, input().split()))\n\n A = sorted(A)\n\n ans = 0\n\n for i in range(N):\n Ai = A[i]\n is_divisible = False\n for j in range(i):\n Aj = A[j]\n if Aj**2 > Ai:\n break\n if Ai%Aj == 0:\n is_divisible = True\n break\n if not is_divisible:\n ans += 1\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n', '\n N = int(input())\n A = list(map(int, input().split()))\n\n A = sorted(A)\n\n ans = 0\n\n for i in range(N):\n Ai = A[i]\n is_divisible = False\n for j in range(i):\n Aj = A[j]\n if Aj**2 > Ai:\n break\n if Ai%Aj == 0:\n is_divisible = True\n break\n if not is_divisible:\n ans += 1\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n', 'def main():\n\n N = int(input())\n A = list(map(int, input().split()))\n\n A = sorted(A)\n Amax = A[-1]\n count = [0 for _ in range(Amax+1)]\n\n for a in A:\n for i in range(1, Amax//a+1):\n count[i*a] += 1\n\n ans = 0\n for i in range(N):\n a = A[i]\n if count[a] == 1:\n# print(i) \n ans += 1\n\n print(ans)\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s257041402', 's445220654', 's838922205', 's773702772'] | [32272.0, 32376.0, 9000.0, 32232.0] | [427.0, 2206.0, 24.0, 429.0] | [570, 465, 453, 549] |
p02642 | u314089899 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import collections\n\n#N = int(input())\n\n\nimport random\nN = 2 * 10**5\nA_list = [random.randrange(1,10**6) for _ in range(N+1)]\n\nA_counter = collections.Counter(A_list)\n\nmax_A = max(A_list)\n\nA_list.sort(reverse=False)\nOK_set = set(A_list)\n\nans = list()\n\n\n\nfor i in range(0,N):\n A = A_list[i]\n\n if A*2 <= max_A:\n multiple_set = {A*j for j in range(2,1+max_A//A)}\n #print(multiple_set)\n OK_set -= multiple_set\n\n if A_counter[A] != 1:\n OK_set -= {A}\n \n #print(OK_set)\n\nprint(len(OK_set)) ', 'import collections\n\nN = int(input())\nA_list = [int(e) for e in input().split()]\n\n#import random\n#N = 2 * 10**5\n#A_list = [random.randrange(1,10**6) for _ in range(N+1)]\n\nA_counter = collections.Counter(A_list)\n\nmax_A = max(A_list)\n\nA_list.sort(reverse=False)\nOK_set = set(A_list)\n\nans = list()\n\n\n\nfor i in range(0,N):\n A = A_list[i]\n\n if A*2 <= max_A:\n multiple_set = {A*j for j in range(2,1+max_A//A)}\n #print(multiple_set)\n OK_set -= multiple_set\n\n if A_counter[A] != 1:\n OK_set -= {A}\n \n #print(OK_set)\n\nprint(len(OK_set)) '] | ['Wrong Answer', 'Accepted'] | ['s787703455', 's233525979'] | [134100.0, 100236.0] | [812.0, 489.0] | [681, 682] |
p02642 | u316733945 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\na.sort()\nnum = 0\nl = []\n\nfor i in range(n):\n flag = 0\n if i == 0:\n if a[0]==a[1]:\n l.append(a[0])\n continue\n else:\n l.append(a[0])\n num += 1\n continue\n for j in l:\n if a[i]%j:\n flag = 1\n break\n else:\n break\n if flag:\n l.append(a[i])\n num += 1\n\nprint(num)', 'n = int(input())\na = list(map(int, input().split()))\n\nl = [0]*(10**6 +1)\nfor i in a:\n l[i]+=1\nnum = 0\n\nfor i in range(10**6+1):\n if l[i] == 1:\n num += 1\n if l[i] != 0:\n for j in range(2*i, 10**6+1, i):\n if l[j]:\n l[j] += 1\nprint(num)'] | ['Runtime Error', 'Accepted'] | ['s306524901', 's248538867'] | [32160.0, 32180.0] | [218.0, 1344.0] | [449, 282] |
p02642 | u317423698 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\nfrom itertools import groupby\n\nreadline = sys.stdin.buffer.readline\nreadline()\nb = list(map(int, readline().split()))\n\nb.sort(reverse=True)\n# print(b)\n\nx = len(b)\nc = [(k, len(tuple(L))) for k, L in groupby(b)]\n# print(c)\nfor i, v in enumerate(c):\n if v[1] > 1:\n x -= v[1]\n continue\n for vv in c[-1:i:-1]:\n print(v[0], vv[0])\n if not v[0] % vv[0]:\n x -= 1\n break\nprint(x)', 'import sys\nfrom itertools import groupby\n\nreadline = sys.stdin.buffer.readline\na = map(int, readline().split())\nb = list(map(int, readline().split()))\nb.sort(reverse=True)\n# print(b)\n\nx = len(b)\nc = [(k, len(list(L))) for k, L in groupby(b)]\n# print(c)\nfor i, v in enumerate(c):\n if v[1] > 1:\n x -= v[1]\n continue\n for vv in c[i+1:]:\n if not v[0] % vv[0]:\n x -= 1\n continue\nprint(x)', 'import sys\nfrom itertools import groupby\n\nreadline = sys.stdin.buffer.readline\na = map(int, readline().split())\nb = list(map(int, readline().split()))\nb.sort(reverse=True)\nprint(b)\n\nx = len(b)\nc = [(k, len(list(L))) for k, L in groupby(b)]\n# print(c)\nfor i, v in enumerate(c):\n if v[1] > 1:\n x -= v[1]\n break\n for vv in c[i+1:]:\n if not v[0] % vv[0]:\n x -= 1\n break\nprint(x)', 'import sys\nfrom itertools import groupby\n\nreadline = sys.stdin.buffer.readline\nreadline()\nb = list(map(int, readline().split()))\n\nb.sort()\n# print(b)\n\nx = len(b)\nc = [(k, len(tuple(L))) for k, L in groupby(b)]\n# print(c)\nm = c[-1][0]\n# print(m)\ns = [True] * (m + 1)\n# print(len(s))\n\na = 0\nfor i, le in c:\n if s[i]:\n if le <= 1:\n a += 1\n for v in range(i, m + 1, i):\n s[v] = False\n# print(s)\nprint(a)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s296971396', 's362056424', 's366411649', 's322643816'] | [67948.0, 34168.0, 32644.0, 38640.0] | [2279.0, 2206.0, 2206.0, 337.0] | [406, 403, 395, 416] |
p02642 | u321035578 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["def main():\n n = int(input())\n a = list(map(int,input().split()))\n\n ans = 0\n from collections import Counter\n cnt = Counter(a)\n lim = max(a) + 1\n tmp = [0] * (lim)\n # set_a = list(set(a))\n # set_a.sort()\n a.sort()\n\n for aa in a:\n if tmp[aa] == 0:\n for j in range(lim):\n if aa * j > lim-1:\n break\n tmp[j] = 1\n\n if cnt[aa] == 1:\n # print(aa, ans)\n ans += 1\n\n\n\n\n print(ans)\n\nif __name__=='__main__':\n main()\n", "def main():\n n = int(input())\n a = list(map(int,input().split()))\n\n ans = 0\n from collections import Counter\n cnt = Counter(a)\n lim = max(a) + 1\n tmp = [0] * (lim)\n # set_a = list(set(a))\n # set_a.sort()\n a.sort()\n\n for aa in a:\n if tmp[aa] == 0:\n for j in range(aa,lim,aa):\n\n tmp[j] = 1\n\n if cnt[aa] == 1:\n # print(aa, ans)\n ans += 1\n\n\n\n\n print(ans)\n\nif __name__=='__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s233783984', 's880160844'] | [38676.0, 38564.0] | [286.0, 281.0] | [552, 498] |
p02642 | u331105860 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numba\nfrom numba import njit, b1, i4, i8, f8\nimport numpy as np \n\nN = int(input())\nA = np.array(sorted([int(x) for x in input().split()]))\n\nprint(A)\n\n\n@njit((i8[:], ), cache=True)\ndef main(A):\n ans = 0\n for i in range(len(A) - 1, 0, -1):\n for j in range(i):\n if A[i] == A[j]:\n continue\n if A[i] % A[j] == 0:\n break\n if A[i] < A[j] * 2 or j == i - 1:\n ans += 1\n break\n if A[0] != A[1]:\n ans += 1\n return ans\n\n\nprint(main(A))\n', 'import numba\nfrom numba import njit, b1, i4, i8, f8\nimport numpy as np \n\nN = int(input())\nA = np.array([int(x) for x in input().split()], dtype=np.int32)\n\n\n@njit((i4[:], ), cache=True)\ndef main(A):\n count = np.zeros(10**6 + 10, np.int32)\n for x in A:\n if count[x] > 1:\n continue\n count[::x] += 1\n ret = 0\n for x in A:\n ret += count[x] == 1\n return ret\n\n\nprint(main(A))\n'] | ['Wrong Answer', 'Accepted'] | ['s297601548', 's359031754'] | [115144.0, 121484.0] | [2208.0, 739.0] | [557, 423] |
p02642 | u340040203 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["import sys\nimport numpy as np\ninput = lambda: sys.stdin.readline().rstrip()\n\ndef main():\n n = int(input())\n a = list(map(int, input().split()))\n a = sorted([i for i in a if a.count(i) == 1])\n a = np.array(a)\n ans = []\n if let(set(a)) == 1:\n print(0)\n return\n while a != []:\n ans.append(a[0])\n a = a[a%a[0] != 0]\n print(len(ans)+1)\n \nif __name__ == '__main__':\n main()", "import sys\nimport collections\ninput = lambda: sys.stdin.readline().rstrip()\n\ndef main():\n n = int(input())\n a = sorted([int(i) for i in input().split()])\n cnt_list = collections.Counter(a)\n search_list = [0] * (a[-1]+1)\n ans = 0\n for num, cnt in cnt_list.items():\n search_list[num] = cnt\n for i in a:\n if search_list[i] == 1:\n ans += 1\n for j in range(i, a[-1]+1, i):\n search_list[j] = 0\n print(ans)\n \nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s089398874', 's652129197'] | [51556.0, 38220.0] | [2206.0, 362.0] | [425, 509] |
p02642 | u343021464 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\ncounter = [0 for _ in range(n)]\nfor i in range(n):\n for j in range(n):\n if i == j:\n continue\n else:\n if counter[i] > 0:\n continue\n else:\n if a[i] % a[j] == 0:\n counter[i] += 1:\nprint(counter.count(0))', 'import numpy as np\n \nn = int(input())\na = list(map(int, input().split()))\na.sort()\ndp = [0 for _ in range(a[-1] + 1)]\n\nfor x in a:\n for j in range(x, a[-1] + 1, x):\n dp[j] += 1\nfor i, result in enumerate(dp):\n print(i, result)\nprint("#" * 15)\nans = 0\nfor x in a:\n #print(x)\n if dp[x] == 1:\n ans += 1\nprint(ans)', 'import numpy as np\n \nn = int(input())\na = list(map(int, input().split()))\na.sort()\ndp = [0 for _ in range(a[-1] + 1)]\n\nfor x in a:\n for j in range(x, a[-1] + 1, x):\n dp[j] += 1\nans = 0\nfor x in set(a):\n #print(x)\n if dp[x] == 1:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s658874350', 's791946031', 's688687280'] | [9048.0, 51708.0, 59408.0] | [27.0, 1266.0, 545.0] | [352, 336, 272] |
p02642 | u347203174 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\n\nN = int(input())\nMAXX = 10**6 + 5\nnum = np.array(input().split(), np.int32)[:]\nmark = np.zeros(MAXX, np.int32)\n\nnum = np.sort(num)\nfor n in num:\n if mark[n::n] < 2:\n mark[n::n] += 1\n\ncount = 0\nfor n in num:\n if mark[n] == 1:\n count += 1\n\nprint(count)', 'import numpy as np\n\nN = int(input())\nMAXX = 10**6 + 5\nnum = np.array(input().split(), np.int32)[:]\nmark = np.zeros(MAXX, np.int32)\n\nnum = np.sort(num)\nfor n in num:\n if mark[n] < 2:\n mark[n::n] += 1\n\ncount = 0\nfor n in num:\n if mark[n] == 1:\n count += 1\n\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s732528072', 's338361679'] | [49932.0, 49780.0] | [1062.0, 1117.0] | [290, 287] |
p02642 | u347600233 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = sorted([int(i) for i in input().split()])\ncnt_d = [0] * (max(a) + 1)\ncnt_nd = 0\nfor ai in a:\n if cnt_d[ai] >= 1:\n continue\n else:\n cnt_d[ai] += 1\n cnt_nd += 1\n multi = 2\n while ai*multi <= max_a:\n cnt_d[ai*multi] += 1\n multi += 1\nprint(cnt_nd)', 'n = int(input())\na = sorted([int(i) for i in input().split()])\nmax_a = max(a)\ncnt_d = [0] * (max_a + 1)\n\nfor ai in a:\n for multi in range(ai, max_a + 1, ai):\n cnt_d[multi] += 1\n\nprint(cnt_d.count(1))', 'n = int(input())\na = [int(i) for i in input().split()]\nmax_a = max(a)\ncnt_d = [0] * (max_a + 1)\n\nfor ai in a:\n for multi in range(ai, max_a + 1, ai):\n cnt_d[multi] += 1\n\nprint(sum(cnt_d[ai] == 1 for ai in a))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s387393923', 's771304092', 's474849491'] | [32200.0, 32104.0, 31992.0] | [126.0, 470.0, 428.0] | [311, 209, 218] |
p02642 | u347640436 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\n\nA = sorted(set(A))\nt = [True] * (10 ** 6 + 1)\n\nfor a in A:\n for i in range(a, 10 ** 6 + 1, a):\n t[i] = False\n\nresult = 0\nfor a in A:\n if t[a]:\n result += 1\nprint(result)\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nt = [True] * (10 ** 6 + 1)\nd = {}\nfor a in A:\n d.setdefault(a, 0)\n d[a] += 1\n if d[a] > 1:\n t[a] = False\n\nfor a in sorted(set(A)):\n for i in range(a + a, 10 ** 6 + 1, a):\n t[i] = False\nprint(t.count(True))\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nd = {}\nfor a in A:\n d.setdefault(a, 0)\n d[a] += 1\n\nA = sorted(set(A))\nt = [True] * (10 ** 6 + 1)\nfor a in A:\n if d[a] > 1:\n t[a] = False\n for i in range(a + a, 10 ** 6 + 1, a):\n t[i] = False\nprint(sum(1 for a in A if t[a]))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s489882341', 's637024465', 's614569389'] | [32256.0, 52052.0, 44212.0] | [1163.0, 1246.0, 1820.0] | [244, 286, 304] |
p02642 | u348432940 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['# D - Not Divisible\ndef aline_mintomax(arr, N):\n for i in reversed(range(1,N)):\n for j in range(i):\n if arr[j] > arr[j+1]:\n arr[j], arr[j+1] = arr[j+1], arr[j]\n return arr\n\nN = int(input()) \nnum_list = list(map(int, input().split())) \nind_list = [i for i in range(N)]\nnum_list = aline_mintomax(num_list, N)\nfor i in range(N-1):\n if num_list[i+1] == num_list[i]:\n ind_list[i] = -1\n continue\n for j in range(i):\n if num_list[i] % num_list[j] == 0 :\n ind_list[i] = -1\n break\nfor i in range(N-1):\n if num_list[N-1] % num_list[i] == 0 :\n ind_list[N-1] = -1\n break\nprint(ind_list.count(-1))', '# D - Not Divisible\ndef aline_mintomax(arr, N):\n for i in reversed(range(1,N)):\n for j in range(i):\n if arr[j] > arr[j+1]:\n arr[j], arr[j+1] = arr[j+1], arr[j]\n return arr\n\nN = int(input()) \nnum_list = list(map(int, input().split())) \nind_list = [i for i in range(N)]\nnum_list = aline_mintomax(num_list, N)\nfor i in range(N-1):\n if num_list[i+1] == num_list[i]:\n ind_list[i] = -1\n continue\n for j in range(i):\n if num_list[i] % num_list[j] == 0 :\n ind_list[i] = -1\n break\nfor i in range(N-1):\n if num_list[N-1] % num_list[i] == 0 :\n ind_list[i] = -1\n break\nprint(ind_list.count(-1))', '# D - Not Divisible\nN = int(input())\na = list(map(int, input().split()))\na.sort()\nMAX = a[-1]\nl = [0]*(MAX+1)\nfor i in range(N):\n l[a[i]] += 1\n \nanswer = 0\nfor i in range(N):\n if l[a[i]] == 1:\n answer += 1\n for g in range(a[i], MAX+1, a[i]):\n l[g] = 10\nprint(answer)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s102731465', 's401387224', 's949867041'] | [32356.0, 32244.0, 32232.0] | [2206.0, 2206.0, 413.0] | [708, 706, 292] |
p02642 | u350248178 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\nn,*a=map(int,open(0).read().split())\nl=np.zeros(max(a)+1)\na.sort()\na+=[10**7]\nr=0\nfor i,j in zip(a,a[1:]):\n if l[i]==0:\n l[::i]=1\n if i!=j:\n r+=1\n print(i)\nprint(r)', 'import numpy as np\nn,*a=map(int,open(0).read().split())\nl=np.zeros(max(a)+1)\na.sort()\na+=[10**7]\nr=0\nfor i,j in zip(a,a[1:]):\n if l[i]==0:\n l[::i]=1\n if i!=j:\n r+=1\nprint(r)'] | ['Wrong Answer', 'Accepted'] | ['s506562187', 's140034278'] | [50460.0, 50528.0] | [494.0, 394.0] | [222, 201] |
p02642 | u350997995 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\nN = int(input())\nA = list(map(int,input().split()))\nC = Counter(A).most_common()\n\nMAXN = max(A)\nB = [False]*(MAXN+1)\nfor c in C:\n B[c[0]] = True\nans = 0\nfor i in range(MAXN + 1):\n if B[i]:\n if C[i]==1:\n ans += 1\n B[i::i] = [False]*(MAXN//i)\nprint(ans)', 'from collections import Counter\nN = int(input())\nA = list(map(int,input().split()))\nC = Counter(A)\n\nMAXN = max(A)\nB = [False]*(MAXN+1)\nfor c in C.most_common():\n B[c[0]] = True\nans = 0\nfor i in range(MAXN + 1):\n if B[i]:\n if C[i]==1:\n ans += 1\n B[i::i] = [False]*(MAXN//i)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s797493598', 's047066780'] | [52248.0, 52196.0] | [241.0, 302.0] | [314, 314] |
p02642 | u354804355 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n n=int(input())\n a=sorted(map(int,input().split()))\n maxa=a[-1]\n tf=[True]*maxa\n r=0\n n-=1\n for i in range(n): \n a_i=a[i]\n if tf[a_i-1] ==True: \n for j in range(a_i - 1,maxa,a_i):\n tf[j]=False\n if a_i < a[i+1]: \n print(a_i)\n r+=1\n if tf[-1] == True: \n r+=1\n print(r)\nmain()', 'def main():\n n=int(input())\n a=sorted(map(int,input().split()))\n maxa=a[-1]\n tf=[True]*maxa\n r=0\n n-=1\n for i in range(n): \n a_i=a[i]\n if tf[a_i-1] ==True: \n for j in range(a_i - 1,maxa,a_i):\n tf[j]=False\n if a_i < a[i+1]: \n r+=1\n if tf[-1] == True: \n r+=1\n print(r)\nmain()'] | ['Wrong Answer', 'Accepted'] | ['s341578773', 's140248764'] | [32136.0, 32248.0] | [262.0, 282.0] | [463, 444] |
p02642 | u355078864 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from sys import stdin\n\nn = [int(x) for x in stdin.readline().rstrip().split()]\nP = [int(x) for x in stdin.readline().rstrip().split()]\n\nrest_lists = []\n\nP.sort()\n\ndef return_filtered(div, rl):\n new = []\n protect = True\n for tgt in rl:\n if protect and tgt == div:\n new.append(tgt)\n protect = False\n elif tgt == div and len(new) >0:\n new.pop()\n elif not tgt % div == 0:\n new.append(tgt)\n print(new)\n return new\n\nnew_list = P\nk = 0\nwhile True:\n if len(new_list) == 0:\n break\n k += 1\n if 1+k >= len(new_list):\n break\n new_list = return_filtered(new_list[1+k], new_list)\n\nprint(len(new_list))', 'from sys import stdin\n\nn = [int(x) for x in stdin.readline().rstrip().split()]\nP = [int(x) for x in stdin.readline().rstrip().split()]\n\nrest_lists = []\n\nP.sort()\n\ndef return_filtered(div, rl):\n new = []\n protect = True\n for tgt in rl:\n if protect and tgt == div:\n new.append(tgt)\n protect = False\n elif tgt == div and len(new) >0:\n new.pop()\n elif not tgt % div == 0:\n new.append(tgt)\n print(new)\n return new\n\nnew_list = P\nk = 0\nwhile True:\n if len(new_list) == 0:\n break\n k += 1\n if 1+k > len(new_list):\n break\n new_list = return_filtered(new_list[1+k], new_list)\n\nprint(len(new_list))', "from sys import stdin\n\nn = [int(x) for x in stdin.readline().rstrip().split()]\na = [int(x) for x in stdin.readline().rstrip().split()]\n\n\n\n# import math\n# if not isinstance(n, int):\n# raise TypeError('n is int type.')\n# if n < 2:\n# raise ValueError('n is more than 2')\n\n\n\n# while True:\n# p = data[0]\n\n\n\n\n\n\n\n\n\ncnt = [0] * ((10**6)+1)\nfor elem in a:\n cnt[elem] += 1\n\nfiltered = []\n\nfor i in range((10**6)+1):\n if cnt[i] == 1:\n filtered.append(i)\n\n\ncnt = [0] * ((10**6)+1)\n\n\na = list(set(a))\nfor elem in a:\n \n \n for i in range(elem*2, (10**6)+1, elem):\n cnt[i] += 1\n\nans = 0\n\nfor i in filtered:\n if cnt[i] == 0:\n ans += 1\n\nprint(ans)\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s830132207', 's837758624', 's622457077'] | [103724.0, 98248.0, 47404.0] | [3349.0, 2912.0, 1984.0] | [693, 692, 1373] |
p02642 | u357751375 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int,input().split()))\na.sort(reverse = True)\np = 0\nif 1 in a:\n if a.count(1) >= 2:\n print(0)\n exit(0)\n else:\n print(1)\n exit(0)\n\nfor i in range(n):\n if a.count(a[i]) >= 2:\n pass\n else:\n for j in range(n):\n if a[i] % a[j] == 0:\n break\n else:\n pass\n if j == n - 1:\n p += 1\n\nprint(p)', 'n = int(input())\na = list(map(int,input().split()))\na.sort(reverse = True)\np = 0\n \nfor i in range(n):\n j = i + 1 \n while j < n:\n if i == j:\n pass\n elif a[i] % a[j] == 0:\n break\n else:\n pass\n if j == n - 1:\n p += 1\n\t j += 1\n \nprint(p)', 'n = int(input())\na = list(map(int,input().split()))\na.sort(reverse = True)\np = 0\n\nfor i in range(n):\n j = i + 1\n while j < n:\n if i == j:\n pass\n elif a[i] % a[j] == 0:\n break\n else:\n pass\n if j == n - 1:\n p += 1\n j += 1\n\nprint(p)', 'n = int(input())\na = list(map(int,input().split()))\na.sort(reverse = True)\np = 0\n\nfor i in range(n):\n j = i + 1\n while j < n:\n if i == j:\n pass\n elif a[i] % a[j] == 0:\n break\n else:\n pass\n if j == n - 1:\n p += 1\n\t j += 1\n\nprint(p)', 'n = int(input())\na = list(map(int,input().split()))\nm = max(a)\nflag = [True]*(m+1)\nc = [0]*(m+1)\nb = list(sorted(a))\nfor i in b:\n x = i + i\n while x <= m:\n flag[x] = False\n x += i\n c[i] += 1\nans = 0\nx = 0\nl = []\nans = 0\nfor i in a:\n if flag[i] and c[i] <= 1:\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s200006687', 's212409072', 's506286264', 's910073165', 's559073912'] | [32376.0, 9032.0, 32072.0, 9044.0, 37292.0] | [2206.0, 19.0, 2206.0, 25.0, 533.0] | [442, 350, 314, 311, 312] |
p02642 | u364774090 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nB = [0] * (2 * 10 ** 5 + 1)\nM = max(A)\n\nfor a in A:\n\tB[a] += 1\n\nif sum(B) == N:\n\tprint(0)\nelse:\n\tfor a in A:\n\t\tif B[a] > 0:\n\t\t\ti = 2\n\t\t\tb = a * i\n\t\t\twhile b <= M:\n\t\t\t\tB[b] = 0\n\t\t\t\ti += 1\n\t\t\t\tb = a * i\n\tfor b in B:\n\t\tif b > 1:\n\t\t\tB[b] = 0\n\tprint(sum(B))', 'N = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nfor i in range(N):\n for j in range(N):\n if i != j:\n if A[i] % A[j] != 0:\n ans += 1\n break\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nB = [0] * (2 * 10 ** 5 + 1)\nM = max(A)\n\nfor a in A:\n pass', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nB = [0] * (2 * 10 ** 5 + 1)\nM = max(A)', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nB = [0] * (2 * 10 ** 5 + 1)\nM = max(A)\n\nfor a in A:\n\tB[a] += 1\n\nif max(B) == N:\n\tprint(0)\nelse:\n\tfor a in A:\n\t\tif B[a] > 0:\n\t\t\ti = 2\n\t\t\tb = a * i\n\t\t\twhile b <= M:\n\t\t\t\tB[b] = 0\n\t\t\t\ti += 1\n\t\t\t\tb = a * i', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nB = [0] * (2 * 10 ** 5 + 1)\nM = max(A)\n\nfor a in A:\n\tB[a] += 1\n\nif max(B) == N:\n\tprint(0)\nelse:\n\tfor a in A:\n\t\tpass', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nB = [0] * (2 * 10 ** 5 + 1)\nM = max(A)\n\nfor a in A:\n\tB[a] += 1', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nM = max(A)\nB = [0] * (M + 1)\n\nfor a in A:\n B[a] += 1\n\nfor a in A:\n if B[a] > 0:\n i = 2\n b = a * i\n while b <= M:\n B[b] = 0\n i += 1\n b = a * i\nfor i in range(M + 1):\n if B[i] > 1:\n B[i] = 0\nprint(sum(B))'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s071693228', 's080340058', 's243400627', 's352017469', 's674146303', 's745307093', 's901148431', 's163609700'] | [32160.0, 32096.0, 32172.0, 32236.0, 32380.0, 32164.0, 32292.0, 32256.0] | [144.0, 2206.0, 112.0, 106.0, 235.0, 141.0, 134.0, 735.0] | [314, 213, 120, 100, 262, 177, 124, 334] |
p02642 | u366996583 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import collections\nn=int(input())\nl=list(map(int,input().split()))\nc=collections.Counter(l)\ndef j(n):\n j=1\n for k in c.keys():\n if n%k==0:\n if n!=k:\n j=0\n break\ncount=0\nfor i in c.keys():\n if j(i)==1:\n count+=1\nprint(count)', 'n=int(input())\na=list(map(int,input().split()))\ndp=[0]*(10**6+1)\nfor i in a:\n dp[i]+=1\nfor i in range(1,10**6+1):\n if dp[i]:\n for j in range(2*i,10**6+1,i):\n dp[j]=0\nprint(dp.count(1))'] | ['Wrong Answer', 'Accepted'] | ['s314349501', 's308340895'] | [36108.0, 32016.0] | [2206.0, 446.0] | [260, 195] |
p02642 | u372501464 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nAl = [int(i) for i in input().split()]\n\nans = 0\ndivjl = []\n\nfor i in range(len(Al)):\n if i in divjl:\n continue\n flag = True\n for j in range(len(Al)):\n if i == j:\n continue\n if Al[i] % Al[j] == 0:\n flag = False\n divjl.append(j)\n if flag:\n ans += 1\n\nprint(ans)', 'N = int(input())\nAl = sorted([int(i) for i in input().split()])\nmaxAl = Al[-1]\nmarkl = [-1] * (maxAl+1)\n\nfor i in Al:\n if markl[i] == 1:\n continue\n if markl[i] == 0:\n markl[i] = 1\n continue\n markl[i] = 0\n p = i*2\n while p <= maxAl:\n markl[p] = 1\n p += i\nprint(markl.count(0))'] | ['Wrong Answer', 'Accepted'] | ['s467582190', 's821215173'] | [32016.0, 32192.0] | [2206.0, 466.0] | [365, 325] |
p02642 | u373047809 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\nn, *A = map(int, open(0).read().split())\nA.sort()\nc, s = Counter(A), set()\nM = max(A) + 1\nans = 0\nfor a in A:\n if a in s:\n continue\n ans += c[a] == 1\n for i in range(a * a, M, a):\n s.add(i)\nprint(ans)', 'from collections import Counter\nn, *A = map(int, open(0).read().split())\nA.sort()\nc, s = Counter(A), set()\nM = max(A) + 1\nans = 0\nfor a in A:\n if a in s:\n continue\n ans += c[a] == 1\n for i in range(a, M, a):\n s.add(i)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s276396956', 's460315199'] | [94292.0, 104604.0] | [472.0, 665.0] | [255, 251] |
p02642 | u374082254 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\n\nsetA = set(A)\nresult = 0\n\nif N == 1:\n print(0)\nelse:\n for i in range(N):\n tmp = A[i]\n A[i] = 0\n setA = set(A)\n A[i] = tmp\n if 1 in setA:\n continue\n\n for a in setA:\n if a == 0:\n continue\n if A[i] % a == 0 or A[i] <= a:\n break\n else:\n result += 1\n\n print(result)\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nsetA = set(A)\nresult = 0\n\nif N == 1:\n print(0)\nelse:\n for i in range(N):\n tmp = A[i]\n A[i] = 0\n setA = set(A)\n A[i] = tmp\n if 1 in setA:\n continue\n\n for a in setA:\n if A[i] % a == 0:\n break\n else:\n result += 1\n\n print(result)\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nsetA = set(A)\nresult = 0\n\nif N == 1:\n print(0)\nelse:\n for i in range(N):\n tmp = A[i]\n A[i] = 0\n setA = set(A)\n A[i] = tmp\n if 1 in setA:\n continue\n\n print(setA)\n for a in setA:\n if a == 0:\n continue\n if A[i] % a == 0 or A[i] <= a:\n break\n else:\n result += 1\n\n print(result)\n', 'from collections import Counter\nN = int(input())\nA = list(map(int, input().split()))\n\nsorted_A = sorted(A)\nresult = 0\nc = Counter(sorted_A)\n\nlendp = sorted_A[-1] + 1\ndp = [0] * lendp\n\nfor a in sorted_A:\n dp[a] += 1\n if dp[a] == 1:\n b = a * 2\n while b < lendp:\n dp[b] += 2\n b += a\n\nprint(dp.count(1))\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s121252204', 's509349915', 's739138095', 's856358404'] | [42300.0, 42480.0, 138644.0, 40084.0] | [2207.0, 2207.0, 2513.0, 645.0] | [447, 386, 467, 377] |
p02642 | u381959472 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\ninput = sys.stdin.readline\n\nN = int(input())\n\nAList = list(map(int, input().split()))\n\nAList.sort()\n\ndp = [0] * (AList[-1] + 1)\n\nfor i in AList:\n dp[i] += 1\n \n if dp[i] == 1:\n for p in range(2 * i, len(dp), i):\n dp[j] += 2\n\nprint(dp.count(1))', 'import sys\ninput = sys.stdin.readline\n\nN = int(input())\n\nAList = list(map(int, input().split()))\n\nAList.sort()\n\ndp = [0] * (AList[-1] + 1)\n\nfor i in AList:\n dp[i] += 1\n \n if dp[i] == 1:\n for p in range(2 * i, len(dp), i):\n dp[p] += 2\n\nprint(dp.count(1))'] | ['Runtime Error', 'Accepted'] | ['s190350380', 's627153457'] | [31296.0, 31456.0] | [217.0, 400.0] | [281, 281] |
p02642 | u382639013 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as np\n\nans = 0\nfor i in range(N):\n if len(A_re) == 0:\n ans = 0\n break\n break\n c = [j for j in A[i]/np.array(A) if j.is_integer() ]\n print(c)\n if len(c) == 1:\n ans += 1\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\ns = list(set(a))\n\nP = [0] * (10 ** 6 + 1)\n\nfor x in s:\n t = x\n while t <= 10**6:\n P[t] += 1\n t += x\n\nans = 0\n\nfor x in a:\n print(P[x])\n if P[x] == 1:\n ans += 1\n\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as npz\n\nans = 0\nfor i in range(N):\n c = list(A[i]%np.array(A))\n if A.count(A[i]) == N:\n ans = 0\n break\n break\n if c.count(0) == 1:\n ans += 1\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as npz\n\nans = 0\nfor i in range(N):\n if A.count(A[i]) == N:\n ans = 0\n break\n break\n c = list(A[i]%np.array(A))\n if c.count(0) == 1:\n ans += 1\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as np\n\nans = 0\nfor i in range(N):\n if len(A_re) == 0:\n ans = 0\n break\n break\n c = [j for j in A[i]/np.array(A) if j.is_integer() ]\n #print(c)\n if len(c) == 1:\n ans += 1\nprint(ans)', 'from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\np = [True] * (10 ** 6 + 1)\ns = list(set(a))\nfor x in s:\n t = x * 2\n while t <= 10 ** 6:\n p[t] = False\n t += x\nans = 0\nfor x in a:\n if c[x] == 1 and p[x] == True:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s282289652', 's293209032', 's424337677', 's692144689', 's987298995', 's920855753'] | [34524.0, 32068.0, 34428.0, 34400.0, 34424.0, 52736.0] | [155.0, 2206.0, 156.0, 164.0, 152.0, 1791.0] | [285, 257, 255, 255, 286, 312] |
p02642 | u386850803 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["N = int(input().strip())\nA = list(map(int, input().strip().split()))\nA.sort()\nAMAX = max(A)\nans = 0\nis_div = [True for i in range(AMAX+1)]\nprint(A)\nfor i in range(N):\n a = A[i]\n if is_div[a]:\n if not ((i > 0 and A[i] == A[i-1]) or (i < N-1 and A[i] == A[i+1])):\n ans += 1\n for j in range(a, AMAX+1, a):\n is_div[j] = False\nprint(f'{ans}')", 'N = int(input().strip())\nA = list(map(int, input().strip().split()))\nA.sort()\nAMAX = max(A)\nans = 0\nis_div = [True for i in range(AMAX+1)]\nfor i in range(N):\n a = A[i]\n if is_div[a]:\n if not ((i > 0 and A[i] == A[i-1]) or (i < N-1 and A[i] == A[i+1])):\n ans += 1\n for j in range(a, AMAX+1, a):\n is_div[j] = False\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s701155833', 's077048063'] | [32232.0, 32224.0] | [417.0, 360.0] | [355, 341] |
p02642 | u391328897 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\nimport math\n\n\ndef int1(x): return int(x) - 1\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef mi1(): return map(int1, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef lli(rows_number): return [li() for _ in range(rows_number)]\n\n\nif __name__ == "__main__":\n n = ii()\n a = li()\n a = sorted(list(set(a)))\n if len(a) == 1:\n print(0)\n exit()\n b = [True] * (a[-1] + 1)\n\n\n def sived(x):\n for not_ans in range(x+x, a[-1]+1, x):\n b[not_ans] = False\n b[0] = False\n for i in a:\n if b[i]:\n sived(i)\n ans = 0\n for i in a:\n if b[i]:\n ans += 1\n print(b)\n', 'import sys\n\ndef ii(): return int(sys.stdin.readline())\ndef li(): return list(map(int, sys.stdin.readline().split()))\n\nif __name__ == "__main__":\n n = ii()\n a = li()\n a = sorted(a)\n a_max = a[-1]\n sive = [True] * (a_max + 1)\n\n def sived(x):\n for non_ans in range(x, a_max+1, x):\n sive[non_ans] = False\n ans = 0\n for i in range(len(a)-1):\n if sive[a[i]]:\n sived(a[i])\n if a[i] != a[i+1]:\n ans += 1\n if sive[a_max]:\n ans += 1\n print(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s443463295', 's730605920'] | [46368.0, 31424.0] | [319.0, 267.0] | [752, 534] |
p02642 | u393224521 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\nn = int(sys.stdin.readline().rstrip("\\n"))\na = [int(s) for s in sys.stdin.readline().rstrip("\\n").split()]\na.sort()\na_true = [True]*n\na_set = set(a)\nif 1 in a or len(a_set) == 1:\n print(0)\nelse:\n a_max = a[n-1]\n i = 0\n while a[i]*2 <= a_max:\n while i < n-1:\n if a[i] == a[i+1]:\n a_true[i] = False\n a_true[i+1] = False\n i += 1\n for j in range(i+1,n):\n if a[j] % a[i] == 0:\n a_true[j] = False\n i += 1\n while i < n-1:\n if a[i] == a[i+1]:\n a_true[i] = False\n a_true[i+1] = False\n i += 1\n print(len([i for i in range(0, n) if a_true[i]]))', 'import sys\nn = int(sys.stdin.readline().rstrip("\\n"))\na = [int(s) for s in sys.stdin.readline().rstrip("\\n").split()]\na_max = max(a)\nc = {num: 0 for num in a}\nfor num in a:\n c[num] += 1\nd = {num: 0 for num in a}\nfor num in a:\n t = 2\n while num * t <= a_max:\n d[num*t] = 1\n t += 1\nans = 0\nfor num in a:\n if c[num] == 1 and d[num] == 0:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s795419327', 's601445759'] | [35524.0, 104256.0] | [194.0, 1229.0] | [697, 388] |
p02642 | u394950523 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\n\nS = sorted(A)\nprint(S)\n\nans = 0\nif S[0] == S[1]:\n for i in range(1, N):\n j = 0\n while S[i] % S[j] > 0:\n j += 1\n if i <= j:\n ans += 1\n break\nelse:\n ans = 1\n for i in range(1, N):\n j = 0\n while S[i] % S[j] > 0:\n j += 1\n if i <= j:\n ans += 1\n break\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\nMAX = 10 ** 6\n\nA.sort()\ns = set()\nans = N\nfor i in range(N):\n a = A[i]\n if a in s:\n ans -= 1\n continue\n if i < N - 1 and A[i + 1] == a:\n ans -= 1\n n = MAX // a\n for i in range(1, n + 1):\n s.add(a * i)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s228078789', 's642206071'] | [33416.0, 86600.0] | [2206.0, 717.0] | [451, 308] |
p02642 | u395620499 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = map(int, input().split())\na = list(sorted(a))\nbig = a[n-1]\nmark = [0]*big\nfor x in a:\n mark[x] += 1\n if mark[x] > 1:\n continue\n for j in range(x*2, big+1, x):\n mark[j] += 1\n\nans = 0\nfor x in a:\n if mark[x] == 1:\n ans += 1\n\nprint(ans)', 'n = int(input())\na = map(int, input().split())\na = list(sorted(a))\nbig = a[n-1]\nmark = [0]*(big+1)\nfor x in a:\n mark[x] += 1\n if mark[x] > 1:\n continue\n for j in range(x*2, big+1, x):\n mark[j] += 1\n\nans = 0\nfor x in a:\n if mark[x] == 1:\n ans += 1\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s277225287', 's457314476'] | [32244.0, 32336.0] | [381.0, 358.0] | [267, 292] |
p02642 | u401452016 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["#170D\ndef main():\n import sys\n from collections import deque\n N = int(sys.stdin.readline())\n A = list(map(int, sys.stdin.readline().split()))\n A = list(set(A))\n A.sort(reverse=True)\n A = deque(A)\n def era(A):\n if len(A)==1:\n print(0)\n return\n for i in range(len(A)):\n for j in range(len(A)-1, i, -1):\n if A[i] % A[j]==0:\n #print(A[j], A[i])\n A.popleft()\n break\n print(len(A))\n \n \n \n era(A)\n\n\nif __name__=='__main__':\n main()", "#170D\ndef main():\n import sys\n from collections import Counter\n import random\n N = int(sys.stdin.readline())\n A = list(map(int, sys.stdin.readline().split()))\n #A = [random.randint(1, 10**6+1) for _ in range(2*(10**5))]\n judge = [0 for _ in range(10**6+1)]\n A.sort()\n B = Counter(A)\n for a in A:\n judge[a] =1\n for a in A:\n if judge[a] ==1:\n if B[a] >=2:\n judge[a] = 0\n for i in range(2*a, 10**6+1, a):\n judge[i] = 0\n \n print(judge.count(1))\n\nif __name__=='__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s634723814', 's191923757'] | [33936.0, 45300.0] | [2206.0, 287.0] | [617, 594] |
p02642 | u402428218 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N =int(input())\nX = [int(i) for i in input().split()]\nY = sorted(X)\ncount=0\n\nANS=[]\nfor i in range(N):\n for j in range(N):\n if Y[i]!=Y[j]:\n if Y[i]%Y[j]==0:\n if Y[i] not in ANS:\n ANS.append(Y[i])\n # print("i",Y[i])\n # print("j",Y[j])\n # ANS.append(Y[j])\n \nfor i in range(len(ANS)):\n if ANS[i] in Y:\n # print(ANS)\n count=count+1\n\nprint(count)', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort() \nAmax = A[-1]\ndp = [1]*(Amax+1) \nans = 0\nfor i in range(len(A)-1):\n p = A[i]\n if dp[p] == 1: \n for q in range(Amax//p+1):\n dp[p*q] = 0 \n if A[i] != A[i+1]: \n ans += 1 \nif dp[Amax] == 1: \n ans += 1\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s373915853', 's441862061'] | [32012.0, 32220.0] | [2206.0, 524.0] | [486, 709] |
p02642 | u406355300 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from copy import deepcopy\nN = int(input())\nA = list(map(int,input().split()))\ncount = 0\nAas = sorted(A)\nfor i,a in enumerate(A):\n flag = 0\n A2 = deepcopy(A)\n del A2[i]\n if a not in A2:\n for b in Aas:\n if a % b == 0:\n flag = 1\n break\n if a/b < 1:\n break\n if flag == 0:\n count += 1\nprint(count)\n\n', 'from copy import deepcopy\nN = int(input())\nA = list(map(int,input().split()))\ncount = 0\nAas = sorted(A)\nAdes = sorted(A,reverse=True)\nfor i,a in enumerate(A):\n flag = 0\n A2 = deepcopy(A)\n del A2[i]\n if a not in A2:\n for b in Aas:\n if a % b == 0:\n flag = 1\n break\n if a/b < 1:\n break\n if flag == 0:\n count += 1\nprint(count)\n\n\n', 'N = int(input())\nA = list(map(int,input().split()))\nM = 1000001\ncnt = [0]*M\nans = 0\nfor x in A:\n if cnt[x] != 0:\n cnt[x] = 2\n continue\n for i in range(x,M,x):\n cnt[i] += 1\nfor x in A:\n if cnt[x] == 1:\n ans += 1\nprint(ans)\n\n \n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s439694619', 's726501803', 's772444755'] | [33144.0, 33144.0, 32024.0] | [2206.0, 2206.0, 552.0] | [391, 430, 265] |
p02642 | u408262366 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n\n \nn = int(input())\na_list = list(sorted(list(map(int,input().split()))))\nsosuu = []\nhukusuu = []\n\nfor i in range(len(a_list)-1,0,-1):\n if a_list[i] == a_list[i-1]:\n hukusuu.append(i)\n hukusuu.append(i-1)\n \nhukusuu = sorted(list(set(hukusuu)),reverse=True)\nfor i in hukusuu:\n a_list.pop(i)\n\nif len(a_list) == 0:\n print(0)\nelse:\n for i in range(len(a_list)-1,-1):\n if len(factorization(a_list[i])) == 1:\n sosuu.append(a_list[i])\n a_list.pop(i)\n while len(a_list) != 0:\n num = a_list.pop()\n iranai = False\n for i in sosuu:\n if num % i == 0:\n iranai = True\n break\n if iranai == False:\n sosuu.append(num)\n\n print(len(sosuu))', 'n = int(input())\nA = list(sorted(list(map(int,input().split()))))\n\nD=set()\nS=set()\nfor i in range(n):\n if A[i] in S:\n D.add(A[i])\n else:\n S.add(A[i])\n\nbiggest = max(S)\ndp = [1 for i in range(biggest+1)]\nfor i in S:\n if i in D:\n dp[i] = 0\n for j in range(2*i,biggest+1,i):\n dp[j] = 0\n\nans = 0\nfor i in A:\n ans += dp[i]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s709575397', 's426461914'] | [46772.0, 39516.0] | [2206.0, 595.0] | [1037, 357] |
p02642 | u408375121 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\na.sort()\nl = [True] * (10**6 + 1)\ncnt = 0\nfor i in range(n):\n d = a[i]\n if l[d]:\n if i < n-1 and a[i] != a[i+1]:\n cnt += 1\n elif i == n-1:\n cnt += 1\n for j in range(d, 10**6 + 1, d):\n l[d] = False\nprint(cnt)', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\nl = [True] * (10**6 + 1)\ncnt = 0\nfor i in range(n):\n d = a[i]\n if l[d]:\n if i < n-1 and a[i] != a[i+1]:\n cnt += 1\n elif i == n-1:\n cnt += 1\n for j in range(d, 10**6 + 1, d):\n l[j] = False\nprint(cnt)\n'] | ['Wrong Answer', 'Accepted'] | ['s307284659', 's637425241'] | [32024.0, 32372.0] | [1086.0, 409.0] | [286, 287] |
p02642 | u410715775 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\nlst = list(map(int,input().split()))\ndct = {}\nfor i in lst:\n dct[i] = dct.get(i, 0) + 1\nans = 0\nfor i in dct:\n ans += (dct[i] == 1)\nprint(ans)', 'n = int(input())\nlst = list(map(int, input().split()))\nlst.sort()\nk = lst[-1]+1\ndp = [0 for i in range(k)]\nans = 0\nfor i in lst:\n if dp[i] == 0:\n ans += 1\n dp[i] = 2\n for j in range(i*2, k, i):\n dp[j] = 1\n elif dp[i] == 2:\n dp[i] = 1\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s902552134', 's147957707'] | [35692.0, 32012.0] | [153.0, 314.0] | [165, 306] |
p02642 | u411923565 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['#D - Div Game\nN = int(input())\n\ndef Prime_factorize(n):\n cnt = 0\n A = set()\n \n z = 2\n while n%2==0 and (n>=z):\n cnt += 1\n n //= z\n\n A.add(z)\n \n z *= 2\n \n f = 3\n z = 3\n \n while f*f <= n:\n if n%z == 0:\n cnt += 1\n n //= z\n A.add(z)\n \n \n z = z*f\n \n else:\n f += 2\n z = f\n\n \n if n != 1 and not(n in A):\n A.add(z)\n cnt += 1\n \n if cnt == 0:\n cnt = 1\n return cnt\nif N == 1:\n ans = 0\nelse:\n ans = Prime_factorize(N)\nprint(ans)', '#D - Div Game\nN = int(input())\n\ndef Prime_factorize(n):\n cnt = 0\n A = set()\n \n z = 2\n while n%2==0 and (n>=z):\n cnt += 1\n n //= z\n\n A.add(z)\n \n z *= 2\n \n f = 3\n z = 3\n \n while f*f <= n:\n if n%z == 0:\n cnt += 1\n n //= z\n A.add(z)\n\n \n z = z*f\n \n else:\n f += 2\n z = f\n\n \n if n != 1 and not(n in A):\n A.add(z)\n cnt += 1\n \n if cnt == 0:\n cnt = 1\n return cnt\nif N == 1:\n ans = 0\nelse:\n ans = Prime_factorize(N)\nprint(ans)', '#D - Not Divisible\nimport collections\nN = int(input())\na = list(map(int,input().split()))\na = sorted(a,reverse = False)\n\n\ncnt = collections.Counter(a)\nm = max(a)+1\nfor i in a:\n if cnt[i] >= 2:\n del cnt[i]\n for j in range(i*2,m,i):\n del cnt[j]\nprint(len(cnt.keys()))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s017191273', 's697907014', 's678207944'] | [9216.0, 9232.0, 37324.0] | [29.0, 29.0, 778.0] | [927, 915, 354] |
p02642 | u414050834 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\na=list(map(int,input().split()))\na.sort()\nm=a[n-1]\ndp=[0]*(m)\nans=0\nfor i in a:\n for j in range(i,m+1,i):\n dp[j]+=1\nfor i in a:\n if dp[i]==1:\n ans+=1\nprint(ans)\n', 'n=int(input())\na=list(map(int,input().split()))\na.sort()\nm=a[n-1]\ndp=[0]*(m+1)\nans=0\nfor i in a:\n for j in range(i,m+1,i):\n dp[j]+=1\nfor i in a:\n if dp[i]==1:\n ans+=1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s412355271', 's416019392'] | [32052.0, 32232.0] | [413.0, 570.0] | [184, 185] |
p02642 | u414980766 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\nM = 1000005\ncnt = [0]*M\nfor a in A:\n if cnt[a]!=0:\n cnt[a]+=1\n continue\n \n for i in range(a, M, a):\n cnt[a]+=1\n \nans = 0\nfor a in A:\n if cnt[a] == 1:\n ans+=1\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\nM = 1000005\ncnt = [0]*M\nfor a in A:\n if cnt[a]!=0:\n cnt[a]+=1\n continue\n \n for i in range(a, M, a):\n cnt[i]+=1\n \nans = 0\nfor a in A:\n if cnt[a] == 1:\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s781647756', 's821930224'] | [32148.0, 32196.0] | [1302.0, 584.0] | [273, 273] |
p02642 | u416258526 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["import numpy as np\nN = int(input())\nAs = list(map(int, input().split(' ')))\nAs = np.unique(np.array(As))\n\ndivisible = np.sum(np.sum((As[None]%As[:,None])==0, 0)>1)\nprint(divisible)", 'n = int(input())\na = list(map(int, input().split()))\n\nmax_a = max(a)\ndp = [0] * (max_a + 1)\n\nfor i in a:\n dp[i] += 1\n if dp[i] ==1:\n for j in range(i, max_a+1, i):\n dp[j] += 1\ndp.count(1)', 'n = int(input())\na = list(map(int, input().split()))\n\nmax_a = max(a)\ndp = [0] * (max_a + 1)\n\nfor i in a:\n for j in range(i, max_a+1, i):\n dp[j] += 1\n \nprint([dp[i] for i in a].count(1))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s692936857', 's863842659', 's182014413'] | [147676.0, 32232.0, 32224.0] | [282.0, 404.0, 403.0] | [180, 211, 202] |
p02642 | u418197217 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\nls = sorted(list(map(int, input().split())))\ndead = []\nfor i in range(round(n ** 0.5) + 1):\n if ls[i] not in dead:\n for j in range(ls[i], ls[-1] + 1, ls[i]):\n if j in ls: \n dead.append(j)\n\nprint(n - len(dead))\n', 'n = int(input())\nls = sorted(list(map(int, input().split())))\ndp = [0] * (ls[-1] + 1)\nfor i in ls:\n dp[i] += 1\n if dp[i] == 1:\n for j in range(i*2, ls[-1] + 1, i):\n dp[j] += 2\n\nprint(dp.count(1))\n\n'] | ['Runtime Error', 'Accepted'] | ['s363653735', 's164426328'] | [32096.0, 31972.0] | [2206.0, 429.0] | [263, 221] |
p02642 | u424241608 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\narr = [int(x) for x in input().split()]\nd = {}\nfor x in arr:\n d[x] = d.get(x,0)+1\n\nmxN = 10**6 + 1\nrp = [True]*mxN\n\n\nfor i in range(2,len(rp)):\n if i not in d or not rp[i]:continue\n for j in range(i+i,mxN,i):\n if j in d: rp[j] = False\n\n#reason for tle\n\n\n\nfor k,v in d.items():\n if v > 1:rp[k] = False\n\nans = sum([(1 if rp[x] else 0) for x in cset])\nprint(ans)\n\n\n\n', 'n = int(input())\narr = [int(x) for x in input().split()]\nd = {}\nfor x in arr:\n d[x] = d.get(x,0)+1\n\nmxN = 10**6 + 1\nrp = [True]*mxN\n\nif 1 in d:\n if d[1] > 1:\n print(0)\n exit()\n else:\n print(1)\n exit()\nfor i in range(2,len(rp)):\n if i not in d or not rp[i]:continue\n for j in range(i+i,mxN,i):\n if j in d: rp[j] = False\n\n#reason for tle\n\n\n\nfor k,v in d.items():\n if v > 1:rp[k] = False\n\nans = sum([(1 if rp[x] else 0) for x in arr])\nprint(ans)\n\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s450208934', 's232418925'] | [38560.0, 38208.0] | [598.0, 446.0] | [387, 467] |
p02642 | u426649993 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n N = int(input())\n A = list(map(int, input().split()))\n\n A.sort()\n\n ans = 1\n modlist = [A[0]]\n for i in range(1, N):\n flag = True\n for j, m in enumerate(modlist):\n if A[i] % m == 0:\n flag = False\n break\n if flag:\n ans += 1\n print(A[i])\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'def main():\n N = int(input())\n A = list(map(int, input().split()))\n\n A.sort()\n\n ans = 1\n modlist = [A[0]]\n for i in range(1, N):\n flag = True\n for j, m in enumerate(modlist):\n if A[i] % m == 0:\n flag = False\n break\n if flag:\n ans += 1\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'from math import sqrt\nfrom collections import Counter\n\n\ndef main():\n N = int(input())\n A = list(map(int, input().split()))\n A.sort()\n\n ans = 0\n p = [0] * (10**6 + 1)\n c = Counter(A)\n\n for a in c.keys():\n tmp = a * 2\n while tmp <= 10**6:\n p[tmp] = 1\n tmp += a\n\n for a in A:\n if p[a] == 0 and c[a] == 1:\n ans += 1\n\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s440710585', 's861424831', 's679621901'] | [32192.0, 32060.0, 43476.0] | [242.0, 170.0, 1053.0] | [406, 382, 446] |
p02642 | u430726059 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\na=list(map(int,input().split()))\nm=max(a)\nalsit=[0]*(m+1)\nfor i in a:\n for j in range(i,m+1,i):\n alist[j]+=1\ncnt=0\nfor i in a:\n if alist[i]==1:\n cnt+=1\nprint(cnt)', 'n=int(input())\na=list(map(int,input().split()))\nm=max(a)\nalist=[0]*(m+1)\nfor i in a:\n for j in range(i,m+1,i):\n alist[j]+=1\ncnt=0\nfor i in a:\n if alist[i]==1:\n cnt+=1\nprint(cnt)'] | ['Runtime Error', 'Accepted'] | ['s255648258', 's669015816'] | [32072.0, 32156.0] | [77.0, 499.0] | [185, 185] |
p02642 | u433375322 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['s = list(map(int,input().split()))\nt = s.pop(0)\ns.sort()\nc = 1\nd = 0\nfor i in range(t):\n for k in range(0,i):\n if s[i]%s[k]==0:\n c = 0\n break\n if c == 1:\n d = d+1\nprint(d)\n \n ', 's = list(map(int,input().split()))\nt = s.pop(0)\ns.sort()\nd = 0\nfor i in range(0,t):\n c = 1\n for k in range(0,i):\n if s[i]%s[k]==0:\n c = 0\n break\n if c == 1:\n d = d+1\nprint(d)\n \n \n', 's = list(map(int,input().split()))\nt = s.pop(0)\ns.sort()\ns.reverse()\nc = 1\nd = 1\nfor i in range(t):\n for k in range(i+1,t):\n if s[i]%s[k]==0:\n c = 0\n break\n if c == 1:\n d = d+1\nprint(d)\n \n \n', 'N = int(input())\nA = list(map(int, input().split()))\nM = 10**6 + 1\ncnt = [0] * M\nfor a in A:\n if cnt[a] != 0:\n cnt[a] += 1\n continue\n for b in range(a, M, a):\n cnt[b] += 1\nans = 0\nfor a in A:\n if cnt[a] == 1:ans += 1\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s091462766', 's508394823', 's823587250', 's853210398'] | [9196.0, 9092.0, 9224.0, 32024.0] | [20.0, 26.0, 23.0, 547.0] | [197, 202, 212, 258] |
p02642 | u434609232 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\nS = set(A)\nM = max(S)\nA.sort()\n\nfor a in A:\n if a == pre_a:\n S.discard(a)\n if a in S:\n j = a * 2\n while j <= M:\n S.discard(j)\n j += a\n pre_a = a\nprint(len(S))', 'N = int(input())\nA = list(map(int, input().split()))\nS = set(A)\nM = max(S)\nA.sort()\n\npre_a = 0\nfor a in A:\n if a == pre_a:\n S.discard(a)\n if a in S:\n j = a * 2\n while j <= M:\n S.discard(j)\n j += a\n pre_a = a\nprint(len(S))'] | ['Runtime Error', 'Accepted'] | ['s368074725', 's942519108'] | [32140.0, 32280.0] | [133.0, 509.0] | [263, 273] |
p02642 | u436519884 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import collections\nn=int(input())\nList=list(map(int,input().split()))\ncontainer=collections.Counter(List)\nif(1 in container):\n if(container[1]==1):\n print(1)\n else:\n print(0)\nelse:\n List.sort()\n seive=[True]*(List[~0]+1)\n count=0\n for each in List:\n i=2\n if(seive[each]):\n while i*each<=List[~0]:\n seive[i*each]=False\n i+=1\n if container[each]==1:\n count+=1\n print(seive)\n print(count)\n', 'import collections\nn=int(input())\nList=list(map(int,input().split()))\ncontainer=collections.Counter(List)\nif(1 in container):\n if(container[1]==1):\n print(1)\n else:\n print(0)\nelse:\n List.sort()\n seive=[True]*(List[~0]+1)\n count=0\n for each in List:\n i=2\n if(seive[each]):\n while i*each<=List[~0]:\n seive[i*each]=False\n i+=1\n if container[each]==1:\n count+=1\n print(seive)\n print(count)\n', 'import collections\ndef check(val):\n flag=1\n for v in range(2,val**.5+1):\n if(val%v==0):\n if(v in x or val//v in x):\n flag=0\n break\n if(flag):\n count+=1\nn=int(input())\na=list(map(int,input().split()))\ncount=0\nx=collections.Counter(a)\nif(1 in x):\n if(x[1]==1):\n print(1)\n else:\n print(0)\nelse:\n for each in a:\n if(x[each]==1):\n check(each)\n print(count)\n ', 'import collections\ndef check(val):\n global x\n global count\n flag=1\n for v in range(2,val**.5+1):\n if(val%v==0):\n if(v in x or val//v in x):\n flag=0\n break\n if(flag):\n count+=1\nn=int(input())\na=list(map(int,input().split()))\ncount=0\nx=collections.Counter(a)\nif(1 in x):\n if(x[1]==1):\n print(1)\n else:\n print(0)\nelse:\n for each in a:\n if(x[each]==1):\n check(each)\n print(count)\n \n', 'import collections\ndef check(val):\n flag=1\n for v in range(2,int(val**0.5+1)):\n if(val%v==0):\n if(v in x or val//v in x):\n flag=0\n break\n if(flag):\n count+=1\nn=int(input())\na=list(map(int,input().split()))\ncount=0\nx=collections.Counter(a)\nif(1 in x):\n if(x[1]==1):\n print(1)\n else:\n print(0)\nelse:\n for each in a:\n if(x[each]==1):\n check(each)\n print(count)\n \n', '\nn=int(input())\nList=list(map(int,input().split()))\n\nList.sort()\nseive=[0]*(List[~0]+1)\ncount=0\nfor each in List:\n for i in range(each,List[-1]+1,each):\n seive[i]+=1\n \nfor each in List:\n if(seive[each]==1):\n count+=1\n\n\nprint(count)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s501353510', 's666293241', 's740032552', 's792244791', 's925414806', 's999967019'] | [49460.0, 49540.0, 36084.0, 35884.0, 35876.0, 32252.0] | [775.0, 728.0, 105.0, 102.0, 108.0, 518.0] | [505, 505, 402, 429, 409, 258] |
p02642 | u437215432 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def func(n, a):\n mx = max(a)\n x = [0] * (mx + 1) # len(x)\n for i in a:\n x[i] += 1\n for i in range(1, mx + 1):\n if x[i] != 0:\n for j in range(2 * i, mx + 1, i):\n x[j] = 0\n if x[i] > 1:\n x[i] = 0\n return sum(x) # 31401\n\nn = int(input())\na = list(map(int, input().split()))\nf(n, a)\n', 'x = [0] * 2 * 10**5\n', 'def func(n, a):\n mx = max(a)\n x = [0] * (mx + 1) # len(x)\n for i in a:\n x[i] += 1\n for i in range(1, mx + 1):\n if x[i] != 0:\n for j in range(2 * i, mx + 1, i):\n x[j] = 0\n if x[i] > 1:\n x[i] = 0\n print(sum(x)) # 31401\n\nn = int(input())\na = list(map(int, input().split()))\nfunc(n, a)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s439389933', 's477377556', 's861721675'] | [32324.0, 10132.0, 32240.0] | [70.0, 29.0, 262.0] | [352, 20, 355] |
p02642 | u439063038 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\n\nN = int(input())\nx_list = np.array(list(map(int, input().split())), reverse=True)\n\ncount = 0\nfor xi in x_list:\n if np.sum(xi%x_list==0) == 1:\n count += 1\nprint(count)', 'import numpy as np\n\nN = int(input())\na_list = list(map(int, input().split()))\n\nnum_array = np.zeros(max(a_list), dtype=np.int8)\nfor a in a_list:\n num_array[a::a] += 1\n\ncount = 0\nfor a in a_list:\n if num_array[a] == 1:\n count += 1\nprint(count)', 'import numpy as np\n \nN = int(input())\nx_list = np.array(list(map(int, input().split()))).reshape(1,N)\n#count = np.sum(x_list%x_list.reshape(N,1)==0, axis=0)==1\n#print(np.sum(count))', 'N = int(input())\nx_list = sorted(list(map(int, input().split())))\n\ncount = 0\nfor i in range(N):\n for j in range(i+1, N):\n if x_list[i]%x_list[j] == 0:\n break\n if j == N-1:\n count += 1\nprint(count)', 'import numpy as np\n\nN = int(input())\na_list = list(map(int, input().split()))\n\nnum_array = np.zeros(max(a_list)+1)\nfor a in a_list:\n num_array[a::a] += 1\n \ncount = 0\nfor a in a_list:\n if num_array[a] == 1:\n count += 1\nprint(count)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s077530581', 's160666796', 's218597729', 's231170409', 's908710718'] | [51484.0, 51452.0, 51584.0, 32296.0, 51176.0] | [155.0, 764.0, 165.0, 2206.0, 641.0] | [192, 249, 181, 213, 240] |
p02642 | u440975163 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\nimport bisect\nn = int(input()) \na = list(map(int, input().split())) \ncnt = Counter(a) \na.sort()\nans = 0\nmx = 10 ** 6\np = [0] * (mx + 1)\nfor i in a:\n if p[a] == 0:\n for j in range(mx + 1):\n x = i * j\n if x > mx:\n break\n p[x] = 1 \n if cnt[a] == 1:\n ans += 1 \nprint(ans)', 'from collections import deque \nn = int(input())\na = list(map(int, input().split()))\na.sort()\na = deque(a)\ny = [min(a)]\nt = []\nwhile a:\n v = a.popleft()\n x = 0\n for j in y:\n if v == j and v not in t:\n t.append(v)\n if v % j == 0:\n break\n else:\n x += 1\n\n if x == len(y):\n y.append(v)\nprint(len(y) - len(t))', 'from collections import Counter\nimport bisect\nn = int(input()) \na = list(map(int, input().split())) \ncnt = Counter(a) \na.sort()\nans = 0\nmx = 10 ** 6\np = [0] * (mx + 1)\nfor i in a:\n if p[i] == 0:\n for j in range(mx + 1):\n x = i * j\n if x > mx:\n break\n p[x] = 1 \n if cnt[i] == 1:\n ans += 1 \nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s115778120', 's954491889', 's644481902'] | [38532.0, 34084.0, 38676.0] | [142.0, 2206.0, 662.0] | [655, 384, 655] |
p02642 | u441254033 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['# D\n\nN = int(input())\nA = list(map(int,input().split()))\n\n\nA.sort()\n\n\nans = 0\n\nfor i in range(N-1):\n for j in range(i+1,N):\n if A[j] % A[i] == 0:\n break\n elif A[j] >= 2 * A[i]:\n break\n else:\n ans += 1\n\nif N == 1:\n ans += 1\nelif A[N-2] != A[N-1]:\n ans += 1\n\nprint(ans)\n', '# D\n\nN = int(input())\n\nd = [0] * (10**6 + 1) \nA = list(map(int, input().split()))\n\nfor a in A:\n d[a] += 1\n\nans = 0\nmaxa = max(A) + 1\nfor i in range(1,maxa):\n if d[i] == 1:\n ans += 1\n\n if d[i] > 0:\n \n for j in range(i*2,maxa,i):\n d[j] = 0\n\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s718151729', 's377729935'] | [32168.0, 40220.0] | [2206.0, 431.0] | [314, 298] |
p02642 | u442877951 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int,input().split()))\nA.sort()\nimport math\nfrom functools import reduce\ndef lcm_base(x, y):\n return (x * y) // math.gcd(x, y)\n\ndef lcm(*numbers):\n return reduce(lcm_base, numbers, 1)\n\ndef lcm_list(numbers):\n return reduce(lcm_base, numbers, 1)\n\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n \n if temp!=1:\n arr.append([temp, 1])\n \n if arr==[]:\n arr.append([n, 1])\n \n return arr\n \nn = lcm_list(A)\nF = factorization(n)\ncount = 0\nfor i,j in F:\n for k in range(j):\n i += i\n if i in A:\n count += 1\n\nprint(count)', 'import numpy as np\nN = int(input())\nA = list(map(int,input().split())) + [10**6+1]\nA.sort()\nB = np.zeros(10**6+1)\ncount = 0\nfor i in range(N):\n if B[A[i]] == 0:\n B[::A[i]] = 1\n if A[i] != A[i+1]:\n count += 1\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s338535403', 's189122105'] | [33092.0, 51344.0] | [2206.0, 407.0] | [779, 232] |
p02642 | u444481227 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n= int(input())\nl=list(map(int,input().split()))\n\nl.sort()\nmaxnum=l[len(l)-1]\nflag=[0]*(maxnum+1)\n\nfor num in l:\n flag[num]+=1\n if flag[num]>1:\n continue\n for j in range(num*2, maxnum, num):\n flag[j]+=1\n#print(flag)\nans=0\n\nfor num in l:\n if flag[num]==1:\n ans+=1\nprint(ans)\n', 'n= int(input())\nl=list(map(int,input().split()))\n\nl.sort()\nmaxnum=l[len(l)-1]\nflag=[0]*(maxnum+1)\n\nfor num in l:\n flag[num]+=1\n if flag[num]>1:\n continue\n for j in range(num*2, maxnum+1, num):\n flag[j]+=1\n#print(flag)\nans=0\n\nfor num in l:\n if flag[num]==1:\n ans+=1\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s344334454', 's169926949'] | [32384.0, 32236.0] | [389.0, 460.0] | [307, 309] |
p02642 | u451017206 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\nfrom math import sqrt\nN = int(input())\nA = [int(v) for v in input().split()]\n\nm = max(A)\nl = [1 for i in range(m+1)]\nfor v in sorted(A):\n if v > sqrt(m):break\n for j in range(2*v, m+1, v):\n l[j] = 0\n\nans = 0\nc = Counter(A)\nfor a in A:\n if c[a] > 1:continue\n ans += l[a]\nprint(ans)', 'from collections import Counter\nN = int(input())\nA = [int(v) for v in input().split()]\n\nm = max(A)\nl = [1 for i in range(m+1)]\nfor v in sorted(A):\n for j in range(2*v, m+1, v):\n l[j] = 0\n\nans = 0\nc = Counter(A)\nfor a in A:\n if c[a] > 1:continue\n ans += l[a]\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s740673156', 's116103083'] | [44676.0, 44660.0] | [311.0, 451.0] | [331, 284] |
p02642 | u455408345 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input(""))\naa=input("").split(" ")\nlista=[]\nfor i in range(n):\n lista+=[int(aa[i])]\nlista.sort()\nlisttf=[]\ns=0\nfor i in range(lista[n-1]):\n listtf+=[True]\nfor i in range(n):\n if(listtf[i]):\n if(i<n-1 and lista[i]==lista[i+1]):\n s-=1\n s+=1\n t=1\n while(t*lista[i]<lista[n-1]):\n listtf[lista[i]*t]=False\n t+=1\nprint(s)\n \n ', 'import math\nn=int(input(""))\naa=input("").split(" ")\nlista=[]\nfor i in range(n):\n lista+=[int(aa[i])]\ns=0\nlista.sort()\nlistde=set()\nfor i in range(n-1):\n if(lista[i]==lista[i+1] ):\n listde.add(lista[i])\nt=0\nfor i in range(n):\n t=0\n for k in listde:\n \n if (lista[i]%k==0):\n t=1\n break\n if (t==0):\n s+=1\n if(lista[i]<=math.sqrt(lista[n-1])):\n listde.add(lista[i])\nprint(s)\n \n \n', 'n=int(input(""))\naa=input("").split(" ")\nlista=[]\nfor i in range(n):\n lista+=[int(aa[i])]\ns=0\nlista.sort()\nlistde=set()\nfor i in range(n-1):\n if(lista[i]==lista[i+1]):\n listde.add(lista[i])\nt=0\nfor i in range(n):\n t=0\n for k in listde:\n if (lista[i]%k==0):\n t=1\n break\n if (t==0):\n s+=1\n listde.ad(lista[i])\nprint(s)\n \n \n', 'n=int(input(""))\naa=input("").split(" ")\nlista=[]\nfor i in range(n):\n lista+=[int(aa[i])]\nlista.sort()\nlisttf=[]\ns=0\nfor i in range(lista[n-1]):\n listtf+=[True]\nfor i in range(n):\n \n if(listtf[lista[i]-1]):\n if(i<n-1 and lista[i]==lista[i+1]):\n s-=1\n s+=1\n t=1\n while(t*lista[i]<=lista[n-1]):\n listtf[lista[i]*t-1]=False\n t+=1\nprint(s)\n \n \n \n \n \n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s192019103', 's837842544', 's925296864', 's234146998'] | [41468.0, 32104.0, 32168.0, 41212.0] | [834.0, 2206.0, 216.0, 985.0] | [417, 468, 396, 458] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.