結果
| 問題 | No.1544 [Cherry 2nd Tune C] Synchroscope |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-07 15:46:31 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 2,000 ms |
| コード長 | 233 bytes |
| 記録 | |
| コンパイル時間 | 917 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 61,312 KB |
| 最終ジャッジ日時 | 2026-05-18 16:38:40 |
| 合計ジャッジ時間 | 4,608 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)