結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー O2MTO2MT
提出日時 2021-06-11 23:24:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 395 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 147,528 KB
最終ジャッジ日時 2023-08-21 14:23:32
合計ジャッジ時間 9,290 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
147,528 KB
testcase_01 AC 71 ms
71,324 KB
testcase_02 AC 71 ms
71,384 KB
testcase_03 AC 106 ms
76,636 KB
testcase_04 AC 143 ms
76,728 KB
testcase_05 AC 119 ms
76,788 KB
testcase_06 AC 134 ms
76,744 KB
testcase_07 AC 127 ms
76,584 KB
testcase_08 AC 110 ms
76,352 KB
testcase_09 AC 84 ms
76,528 KB
testcase_10 AC 129 ms
76,724 KB
testcase_11 AC 110 ms
76,564 KB
testcase_12 AC 106 ms
76,692 KB
testcase_13 AC 81 ms
76,652 KB
testcase_14 AC 147 ms
76,672 KB
testcase_15 AC 161 ms
76,700 KB
testcase_16 AC 106 ms
76,924 KB
testcase_17 AC 95 ms
76,392 KB
testcase_18 AC 80 ms
76,640 KB
testcase_19 AC 80 ms
76,648 KB
testcase_20 AC 136 ms
76,536 KB
testcase_21 AC 91 ms
76,608 KB
testcase_22 AC 80 ms
76,752 KB
testcase_23 AC 188 ms
76,656 KB
testcase_24 AC 192 ms
76,596 KB
testcase_25 AC 194 ms
76,592 KB
testcase_26 AC 189 ms
76,456 KB
testcase_27 AC 175 ms
76,632 KB
testcase_28 AC 194 ms
76,708 KB
testcase_29 AC 190 ms
76,672 KB
testcase_30 AC 190 ms
76,488 KB
testcase_31 AC 192 ms
76,740 KB
testcase_32 AC 176 ms
76,632 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
ans = float('inf')
for i in range(N):
  for j in range(M):
    if A[i] == B[j]:
      num = 0
      while num <= min(N,M):
        if (num*N+i-j)%M == 0:
          flg = True
          ans = min(ans,num*N+i+1)
          break
        num += 1

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