結果

問題 No.2724 Coprime Game 1
ユーザー ゼットゼット
提出日時 2024-04-12 22:19:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 813 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,856 KB
実行使用メモリ 265,292 KB
最終ジャッジ日時 2024-04-12 22:19:18
合計ジャッジ時間 6,681 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 463 ms
254,320 KB
testcase_01 AC 490 ms
254,172 KB
testcase_02 WA -
testcase_03 AC 760 ms
265,156 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

pare=[-1]*(6*10**6+1)
size=[1]*(6*10**6+1)
count=[0]*(6*10**6+1)
def root(x):
  while pare[x]!=-1:
    x=pare[x]
  return x
def unite(u,v):
  rootu=root(u)
  rootv=root(v)
  if rootu!=rootv:
    if size[rootu]>=size[rootv]:
      pare[rootv]=rootu
      size[rootu]+=size[rootv]
      count[rootu]+=count[rootv]
    else:
      pare[rootu]=rootv
      size[rootv]+=size[rootu]
      count[rootv]+=count[rootu]
def same(s,t):
  return root(s)==root(t)
result=[1]*(3*10**6+1)
used=[False]*(3*10**6+1)
for x in range(2,3*10**6+1):
  if used[x]==True:
    continue
  z=1
  for y in range(2,3*10**6):
    if x*y>3*10**6:
      break
    result[x*y]+=z
    if used[x*y]==False:
      used[x*y]=True
      z+=1
Q=int(input())
for _ in range(Q):
  N=int(input())
  if result[N]%2==1:
    print('P')
  else:
    print('K')
0