結果

問題 No.24 数当てゲーム
コンテスト
ユーザー yagi2
提出日時 2017-04-26 12:02:21
言語 Java
(openjdk 27.0.1.0.3 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 151 ms / 5,000 ms
+ 749µs
コード長 1,064 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,925 ms
コンパイル使用メモリ 98,460 KB
実行使用メモリ 48,684 KB
最終ジャッジ日時 2026-11-15 14:25:51
合計ジャッジ時間 5,570 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package yukicoder.No24;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.next());

        Map<Integer, Integer> map = new HashMap<>();

        for (int i = 0; i < 10; i++) map.put(i, 1);

        for (int i = 0; i < N; i++) {
            List<Integer> tmp = new ArrayList<>();
            for (int j = 0; j < 4; j++) tmp.add(Integer.parseInt(sc.next()));

            String YN = sc.next();

            if ("YES".equals(YN)) {
                tmp.forEach(integer -> map.put(integer, map.get(integer) + 1));
            }
            if ("NO".equals(YN)) {
                tmp.forEach(integer -> map.put(integer, 0));
            }
        }

        final int[] max = {Integer.MIN_VALUE};
        final int[] ans = {0};
        map.forEach((integer, integer2) -> {
            if (max[0] < integer2) {
                max[0] = integer2;
                ans[0] = integer;
            }
        });
        System.out.println(ans[0]);
    }
}
0