結果
| 問題 |
No.1544 [Cherry 2nd Tune C] Synchroscope
|
| コンテスト | |
| ユーザー |
Manuel1024
|
| 提出日時 | 2021-05-19 02:18:39 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 481 ms / 2,000 ms |
| コード長 | 566 bytes |
| コンパイル時間 | 3,191 ms |
| コンパイル使用メモリ | 74,272 KB |
| 実行使用メモリ | 47,776 KB |
| 最終ジャッジ日時 | 2024-12-14 21:33:42 |
| 合計ジャッジ時間 | 17,783 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] a = new int[n];
int[] b = new int[m];
for(int i = 0; i < n; i++) a[i] = sc.nextInt();
for(int i = 0; i < m; i++) b[i] = sc.nextInt();
int ans = -1;
for(int i = 0; i < n*m; i++){
if(a[i%n] == b[i%m]){
ans = i+1;
break;
}
}
System.out.println(ans);
}
}
Manuel1024