結果
| 問題 |
No.1544 [Cherry 2nd Tune C] Synchroscope
|
| コンテスト | |
| ユーザー |
SidewaysOwl
|
| 提出日時 | 2021-10-20 19:03:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 138 ms / 2,000 ms |
| コード長 | 338 bytes |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 61,056 KB |
| 最終ジャッジ日時 | 2024-09-20 06:41:17 |
| 合計ジャッジ時間 | 5,175 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
len_a,len_b = len(a),len(b)
import math
ans = -1
LMC = len_a * len_b // math.gcd(len_a,len_b)
for i in range(LMC):
# print(a[i % len_a],b[i % len_b],i+1)
if a[i % len_a] == b[i % len_b]:
ans = i+1
break
print(ans)
SidewaysOwl