結果

問題 No.2666 Decreasing Modulo Nim
ユーザー ks2m
提出日時 2024-03-08 22:32:41
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,010 bytes
コンパイル時間 2,964 ms
コンパイル使用メモリ 78,140 KB
実行使用メモリ 78,620 KB
最終ジャッジ日時 2024-09-29 20:02:13
合計ジャッジ時間 25,083 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 42 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		Set<Integer> set1 = new HashSet<>();
		Set<Integer> set2 = new HashSet<>();
		for (int i = 0; i < n; i++) {
			int v1 = a[i] / m;
			int v2 = a[i] % m;
			if (set1.contains(v1)) {
				set1.remove(v1);
			} else {
				set1.add(v1);
			}
			if (set2.contains(v2)) {
				set2.remove(v2);
			} else {
				set2.add(v2);
			}
		}
		set1.remove(0);
		set2.remove(0);
		if (set1.isEmpty() && set2.isEmpty()) {
			System.out.println("Bob");
		} else {
			System.out.println("Alice");
		}
	}
}
0