結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー AsahiAsahi
提出日時 2023-02-06 08:44:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 948 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 63,896 KB
最終ジャッジ日時 2023-09-17 20:44:45
合計ジャッジ時間 16,816 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
55,600 KB
testcase_01 AC 138 ms
55,288 KB
testcase_02 AC 131 ms
55,696 KB
testcase_03 AC 227 ms
59,720 KB
testcase_04 AC 241 ms
60,112 KB
testcase_05 AC 231 ms
59,312 KB
testcase_06 AC 235 ms
59,128 KB
testcase_07 AC 228 ms
59,136 KB
testcase_08 AC 227 ms
59,252 KB
testcase_09 AC 223 ms
59,548 KB
testcase_10 AC 233 ms
59,688 KB
testcase_11 AC 229 ms
58,896 KB
testcase_12 AC 207 ms
58,944 KB
testcase_13 AC 215 ms
59,148 KB
testcase_14 AC 246 ms
59,576 KB
testcase_15 AC 240 ms
60,256 KB
testcase_16 AC 223 ms
59,836 KB
testcase_17 AC 215 ms
58,988 KB
testcase_18 AC 206 ms
58,220 KB
testcase_19 AC 208 ms
58,988 KB
testcase_20 AC 240 ms
59,352 KB
testcase_21 AC 216 ms
59,440 KB
testcase_22 AC 212 ms
59,272 KB
testcase_23 AC 259 ms
59,892 KB
testcase_24 AC 250 ms
59,708 KB
testcase_25 AC 249 ms
59,744 KB
testcase_26 AC 252 ms
59,760 KB
testcase_27 AC 255 ms
59,852 KB
testcase_28 AC 247 ms
59,568 KB
testcase_29 AC 247 ms
59,488 KB
testcase_30 AC 251 ms
60,028 KB
testcase_31 AC 247 ms
60,552 KB
testcase_32 AC 246 ms
59,400 KB
testcase_33 AC 239 ms
59,776 KB
testcase_34 AC 131 ms
55,300 KB
testcase_35 AC 135 ms
55,484 KB
testcase_36 AC 210 ms
58,968 KB
testcase_37 AC 213 ms
59,236 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[100000];
        int [] b = new int[100000];
        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<100000;i++) a[i] = a[i%n];
        for(int i=0;i<100000;i++) b[i] = b[i%m];
        int ans = -1;
        for(int i=0;i<100000;i++) {
            if(a[i] == b[i]) {
                ans = i+1;
                break;
            }
        }
        output.print(ans);
        output.flush();
    }
}
0