結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー AsahiAsahi
提出日時 2023-02-06 08:51:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 492 ms / 2,000 ms
コード長 841 bytes
コンパイル時間 3,291 ms
コンパイル使用メモリ 70,820 KB
実行使用メモリ 60,520 KB
最終ジャッジ日時 2023-09-17 20:52:10
合計ジャッジ時間 19,086 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,612 KB
testcase_01 AC 129 ms
55,560 KB
testcase_02 AC 131 ms
55,392 KB
testcase_03 AC 235 ms
59,876 KB
testcase_04 AC 247 ms
57,920 KB
testcase_05 AC 235 ms
59,084 KB
testcase_06 AC 239 ms
59,216 KB
testcase_07 AC 237 ms
59,384 KB
testcase_08 AC 231 ms
57,000 KB
testcase_09 AC 234 ms
59,132 KB
testcase_10 AC 234 ms
59,244 KB
testcase_11 AC 224 ms
58,560 KB
testcase_12 AC 218 ms
59,192 KB
testcase_13 AC 212 ms
59,012 KB
testcase_14 AC 240 ms
59,432 KB
testcase_15 AC 251 ms
60,132 KB
testcase_16 AC 231 ms
59,044 KB
testcase_17 AC 215 ms
58,760 KB
testcase_18 AC 206 ms
58,092 KB
testcase_19 AC 202 ms
58,080 KB
testcase_20 AC 234 ms
59,236 KB
testcase_21 AC 219 ms
58,740 KB
testcase_22 AC 207 ms
58,736 KB
testcase_23 AC 258 ms
59,368 KB
testcase_24 AC 259 ms
60,032 KB
testcase_25 AC 264 ms
60,352 KB
testcase_26 AC 254 ms
59,876 KB
testcase_27 AC 257 ms
59,448 KB
testcase_28 AC 259 ms
59,988 KB
testcase_29 AC 264 ms
59,556 KB
testcase_30 AC 256 ms
60,328 KB
testcase_31 AC 257 ms
59,696 KB
testcase_32 AC 260 ms
59,908 KB
testcase_33 AC 459 ms
60,376 KB
testcase_34 AC 128 ms
55,668 KB
testcase_35 AC 130 ms
55,540 KB
testcase_36 AC 213 ms
58,876 KB
testcase_37 AC 212 ms
58,884 KB
testcase_38 AC 483 ms
60,148 KB
testcase_39 AC 480 ms
60,032 KB
testcase_40 AC 492 ms
59,988 KB
testcase_41 AC 468 ms
60,404 KB
testcase_42 AC 489 ms
60,404 KB
testcase_43 AC 475 ms
60,092 KB
testcase_44 AC 470 ms
60,328 KB
testcase_45 AC 468 ms
60,404 KB
testcase_46 AC 487 ms
60,432 KB
testcase_47 AC 483 ms
60,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
// import java.util.stream.Stream;

class Main{
    static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter output = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws IOException{
        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;
            }
        }
        output.print(ans);
        output.flush();
    }
}
0