結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー AsahiAsahi
提出日時 2023-02-06 08:45:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 953 bytes
コンパイル時間 3,074 ms
コンパイル使用メモリ 73,960 KB
実行使用メモリ 53,828 KB
最終ジャッジ日時 2023-09-17 20:46:01
合計ジャッジ時間 16,508 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
47,544 KB
testcase_01 AC 150 ms
47,248 KB
testcase_02 AC 144 ms
47,776 KB
testcase_03 AC 252 ms
52,472 KB
testcase_04 AC 255 ms
52,548 KB
testcase_05 AC 249 ms
52,500 KB
testcase_06 AC 261 ms
52,872 KB
testcase_07 AC 257 ms
53,624 KB
testcase_08 AC 256 ms
53,092 KB
testcase_09 AC 250 ms
52,120 KB
testcase_10 AC 256 ms
52,508 KB
testcase_11 AC 253 ms
52,268 KB
testcase_12 AC 245 ms
52,308 KB
testcase_13 AC 241 ms
52,140 KB
testcase_14 AC 268 ms
52,840 KB
testcase_15 AC 267 ms
53,156 KB
testcase_16 AC 248 ms
52,808 KB
testcase_17 AC 237 ms
51,324 KB
testcase_18 AC 222 ms
50,168 KB
testcase_19 AC 223 ms
49,940 KB
testcase_20 AC 262 ms
52,680 KB
testcase_21 AC 235 ms
51,716 KB
testcase_22 AC 216 ms
50,284 KB
testcase_23 AC 282 ms
53,200 KB
testcase_24 AC 274 ms
53,512 KB
testcase_25 AC 284 ms
53,124 KB
testcase_26 AC 263 ms
53,168 KB
testcase_27 AC 277 ms
53,632 KB
testcase_28 AC 272 ms
53,052 KB
testcase_29 AC 272 ms
53,436 KB
testcase_30 AC 266 ms
53,020 KB
testcase_31 AC 274 ms
53,148 KB
testcase_32 AC 285 ms
53,368 KB
testcase_33 AC 268 ms
53,152 KB
testcase_34 AC 143 ms
47,816 KB
testcase_35 AC 147 ms
48,688 KB
testcase_36 AC 239 ms
52,380 KB
testcase_37 AC 251 ms
52,440 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[1000000];
        int [] b = new int[1000000];
        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<1000000;i++) a[i] = a[i%n];
        for(int i=0;i<1000000;i++) b[i] = b[i%m];
        int ans = -1;
        for(int i=0;i<1000000;i++) {
            if(a[i] == b[i]) {
                ans = i+1;
                break;
            }
        }
        output.print(ans);
        output.flush();
    }
}
0