結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー O2MTO2MT
提出日時 2021-06-11 23:06:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 419 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 78,300 KB
最終ジャッジ日時 2023-08-21 13:57:18
合計ジャッジ時間 9,638 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
78,300 KB
testcase_01 AC 70 ms
71,240 KB
testcase_02 AC 70 ms
71,336 KB
testcase_03 AC 109 ms
76,884 KB
testcase_04 AC 163 ms
77,100 KB
testcase_05 AC 134 ms
77,092 KB
testcase_06 AC 150 ms
77,020 KB
testcase_07 AC 141 ms
76,980 KB
testcase_08 AC 113 ms
76,944 KB
testcase_09 AC 84 ms
76,604 KB
testcase_10 AC 144 ms
76,968 KB
testcase_11 AC 121 ms
77,420 KB
testcase_12 AC 121 ms
76,944 KB
testcase_13 AC 85 ms
76,484 KB
testcase_14 AC 162 ms
77,116 KB
testcase_15 AC 185 ms
76,856 KB
testcase_16 AC 110 ms
76,972 KB
testcase_17 AC 101 ms
76,940 KB
testcase_18 AC 80 ms
76,364 KB
testcase_19 AC 83 ms
76,328 KB
testcase_20 AC 165 ms
77,224 KB
testcase_21 AC 96 ms
76,556 KB
testcase_22 AC 86 ms
76,544 KB
testcase_23 AC 228 ms
77,396 KB
testcase_24 AC 229 ms
77,176 KB
testcase_25 AC 231 ms
77,016 KB
testcase_26 AC 233 ms
77,312 KB
testcase_27 AC 229 ms
76,924 KB
testcase_28 AC 222 ms
77,152 KB
testcase_29 AC 229 ms
77,076 KB
testcase_30 AC 224 ms
77,392 KB
testcase_31 AC 220 ms
77,112 KB
testcase_32 AC 226 ms
77,200 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
flg = False
p = []
ans = float('inf')
for i in range(N):
  for j in range(M):
    if A[i] == B[j]:
      flg = True
      num = 0
      while num*N+i+1 < N*M+1:
        m = (num*N+i-j)/M
        if m.is_integer():
          break
        num += 1
      ans = min(ans,num*N+i+1)

if flg:
  print(ans)
else:
  print(-1)
0