結果

問題 No.1779 Magical Swap
ユーザー ramdosramdos
提出日時 2021-11-03 00:04:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 411 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 1,551 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 99,496 KB
最終ジャッジ日時 2023-09-23 07:44:46
合計ジャッジ時間 5,818 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,296 KB
testcase_01 AC 76 ms
71,232 KB
testcase_02 AC 139 ms
77,900 KB
testcase_03 AC 89 ms
76,776 KB
testcase_04 AC 186 ms
93,948 KB
testcase_05 AC 129 ms
85,160 KB
testcase_06 AC 135 ms
86,480 KB
testcase_07 AC 178 ms
94,900 KB
testcase_08 AC 88 ms
76,628 KB
testcase_09 AC 111 ms
80,440 KB
testcase_10 AC 194 ms
92,768 KB
testcase_11 AC 141 ms
88,028 KB
testcase_12 AC 105 ms
77,692 KB
testcase_13 AC 169 ms
93,000 KB
testcase_14 AC 207 ms
99,496 KB
testcase_15 AC 411 ms
77,956 KB
testcase_16 AC 201 ms
95,524 KB
testcase_17 AC 174 ms
77,944 KB
testcase_18 AC 74 ms
71,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from sys import stdin
def isPrime(n):
  if n == 1: return False
  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return False
  return True

T=int(input())
for _ in range(T):
  N=int(input())
  a=list(map(int, stdin.readline().split()))
  b=list(map(int, stdin.readline().split()))
  flag=0
  for i in range(N):
    if (isPrime(i+1) and (i+1)*2>N) or i==0 :
      if(a[i]!=b[i]):
        flag=1
  if sorted(a)!=sorted(b):
    flag=1
  if flag==0:
    print("Yes")
  else:
    print("No")
0