結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー AsahiAsahi
提出日時 2023-02-06 08:46:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 958 bytes
コンパイル時間 3,075 ms
コンパイル使用メモリ 73,680 KB
実行使用メモリ 142,384 KB
最終ジャッジ日時 2023-09-17 20:48:11
合計ジャッジ時間 24,753 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 227 ms
135,796 KB
testcase_01 AC 244 ms
135,936 KB
testcase_02 AC 230 ms
135,992 KB
testcase_03 AC 406 ms
137,952 KB
testcase_04 AC 412 ms
140,060 KB
testcase_05 AC 376 ms
138,084 KB
testcase_06 AC 405 ms
138,852 KB
testcase_07 AC 379 ms
139,708 KB
testcase_08 AC 374 ms
136,080 KB
testcase_09 AC 390 ms
138,328 KB
testcase_10 AC 423 ms
139,464 KB
testcase_11 AC 408 ms
138,140 KB
testcase_12 AC 400 ms
138,296 KB
testcase_13 AC 399 ms
137,168 KB
testcase_14 AC 395 ms
139,296 KB
testcase_15 AC 416 ms
139,860 KB
testcase_16 AC 399 ms
138,104 KB
testcase_17 AC 377 ms
137,800 KB
testcase_18 AC 354 ms
138,192 KB
testcase_19 AC 357 ms
137,764 KB
testcase_20 AC 416 ms
141,996 KB
testcase_21 AC 412 ms
137,828 KB
testcase_22 AC 376 ms
138,340 KB
testcase_23 AC 425 ms
141,488 KB
testcase_24 AC 424 ms
141,680 KB
testcase_25 AC 424 ms
141,156 KB
testcase_26 AC 395 ms
140,048 KB
testcase_27 AC 399 ms
141,124 KB
testcase_28 AC 398 ms
140,812 KB
testcase_29 AC 434 ms
142,004 KB
testcase_30 AC 425 ms
141,240 KB
testcase_31 AC 426 ms
141,504 KB
testcase_32 AC 442 ms
141,784 KB
testcase_33 AC 370 ms
140,708 KB
testcase_34 AC 233 ms
135,912 KB
testcase_35 AC 248 ms
135,592 KB
testcase_36 AC 340 ms
136,956 KB
testcase_37 AC 335 ms
136,668 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
権限があれば一括ダウンロードができます

ソースコード

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[10000000];
        int [] b = new int[10000000];
        for(int i=0;i<n;i++) a[i] = sc.nextInt();
        for(int i=0;i<m;i++) b[i] = sc.nextInt();
        for(int i=0;i<10000000;i++) a[i] = a[i%n];
        for(int i=0;i<10000000;i++) b[i] = b[i%m];
        int ans = -1;
        for(int i=0;i<10000000;i++) {
            if(a[i] == b[i]) {
                ans = i+1;
                break;
            }
        }
        output.print(ans);
        output.flush();
    }
}
0