結果
| 問題 |
No.1544 [Cherry 2nd Tune C] Synchroscope
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-07 15:46:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 149 ms / 2,000 ms |
| コード長 | 233 bytes |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 61,056 KB |
| 最終ジャッジ日時 | 2024-11-24 15:25:42 |
| 合計ジャッジ時間 | 5,731 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
import math
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
G = math.gcd(N, M)
L = N*M//G
for i in range(L):
if A[i%N]==B[i%M]:
print(i+1)
exit()
print(-1)