結果
問題 | No.1544 [Cherry 2nd Tune C] Synchroscope |
ユーザー |
|
提出日時 | 2021-06-11 21:42:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 740 ms / 2,000 ms |
コード長 | 368 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 82,268 KB |
実行使用メモリ | 60,928 KB |
最終ジャッジ日時 | 2024-12-14 22:56:23 |
合計ジャッジ時間 | 10,242 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 48 |
ソースコード
def gcd(x, y):while y:x, y = y, x%yreturn xdef main():N, M = map(int, input().split())A = list(map(int, input().split()))B = list(map(int, input().split()))for i in range(N*M//gcd(N, M)):if A[i%N] == B[i%M]:print(i+1)breakelse:print("-1")if __name__ == "__main__":main()