結果

問題 No.2619 Sorted Nim
ユーザー tentententen
提出日時 2024-01-29 19:41:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 296 ms / 2,000 ms
コード長 1,868 bytes
コンパイル時間 2,664 ms
コンパイル使用メモリ 90,104 KB
実行使用メモリ 65,300 KB
最終ジャッジ日時 2024-01-29 19:42:17
合計ジャッジ時間 20,435 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
54,104 KB
testcase_01 AC 52 ms
54,092 KB
testcase_02 AC 244 ms
61,392 KB
testcase_03 AC 260 ms
64,340 KB
testcase_04 AC 246 ms
61,604 KB
testcase_05 AC 249 ms
59,520 KB
testcase_06 AC 273 ms
64,820 KB
testcase_07 AC 252 ms
61,564 KB
testcase_08 AC 264 ms
63,872 KB
testcase_09 AC 51 ms
54,112 KB
testcase_10 AC 264 ms
64,188 KB
testcase_11 AC 255 ms
62,180 KB
testcase_12 AC 261 ms
62,032 KB
testcase_13 AC 56 ms
54,112 KB
testcase_14 AC 269 ms
64,084 KB
testcase_15 AC 256 ms
62,144 KB
testcase_16 AC 265 ms
65,300 KB
testcase_17 AC 277 ms
64,200 KB
testcase_18 AC 265 ms
64,676 KB
testcase_19 AC 253 ms
61,416 KB
testcase_20 AC 253 ms
61,376 KB
testcase_21 AC 264 ms
64,460 KB
testcase_22 AC 266 ms
62,416 KB
testcase_23 AC 252 ms
62,800 KB
testcase_24 AC 270 ms
64,100 KB
testcase_25 AC 274 ms
63,808 KB
testcase_26 AC 254 ms
60,204 KB
testcase_27 AC 252 ms
61,428 KB
testcase_28 AC 282 ms
64,020 KB
testcase_29 AC 296 ms
64,408 KB
testcase_30 AC 244 ms
60,772 KB
testcase_31 AC 52 ms
54,116 KB
testcase_32 AC 251 ms
61,476 KB
testcase_33 AC 259 ms
62,644 KB
testcase_34 AC 241 ms
61,528 KB
testcase_35 AC 270 ms
62,368 KB
testcase_36 AC 259 ms
64,296 KB
testcase_37 AC 53 ms
54,120 KB
testcase_38 AC 251 ms
61,556 KB
testcase_39 AC 265 ms
64,324 KB
testcase_40 AC 262 ms
62,744 KB
testcase_41 AC 274 ms
62,292 KB
testcase_42 AC 246 ms
61,796 KB
testcase_43 AC 294 ms
64,216 KB
testcase_44 AC 261 ms
62,112 KB
testcase_45 AC 260 ms
64,240 KB
testcase_46 AC 257 ms
62,324 KB
testcase_47 AC 239 ms
59,676 KB
testcase_48 AC 51 ms
54,108 KB
testcase_49 AC 254 ms
62,432 KB
testcase_50 AC 249 ms
61,484 KB
testcase_51 AC 267 ms
62,588 KB
testcase_52 AC 51 ms
54,104 KB
testcase_53 AC 251 ms
64,516 KB
testcase_54 AC 241 ms
60,348 KB
testcase_55 AC 265 ms
64,124 KB
testcase_56 AC 258 ms
61,824 KB
testcase_57 AC 286 ms
62,356 KB
testcase_58 AC 266 ms
64,060 KB
testcase_59 AC 276 ms
62,168 KB
testcase_60 AC 250 ms
61,308 KB
testcase_61 AC 259 ms
62,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int[] values = new int[n];
        for (int i = 0; i < n; i++) {
            values[i] = sc.nextInt();
        }
        int[] diffs = new int[n];
        diffs[0] = values[0];
        for (int i = 1; i < n; i++) {
            diffs[i] = values[i] - values[i - 1];
        }
        int xor = 0;
        for (int i = n - 1; i >= 0; i -= 2) {
            xor ^= diffs[i];
        }
        System.out.println(xor == 0 ? "Second" : "First");
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0