結果

問題 No.2052 Indegree
ユーザー viral8viral8
提出日時 2022-10-01 10:49:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 71,492 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-08-25 03:18:26
合計ジャッジ時間 6,434 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,944 KB
testcase_01 AC 124 ms
55,816 KB
testcase_02 AC 126 ms
55,504 KB
testcase_03 AC 133 ms
55,996 KB
testcase_04 AC 133 ms
55,692 KB
testcase_05 AC 136 ms
56,268 KB
testcase_06 AC 132 ms
55,760 KB
testcase_07 AC 132 ms
55,764 KB
testcase_08 AC 135 ms
55,796 KB
testcase_09 AC 144 ms
55,760 KB
testcase_10 AC 133 ms
55,796 KB
testcase_11 AC 139 ms
55,500 KB
testcase_12 AC 126 ms
55,728 KB
testcase_13 AC 129 ms
56,296 KB
testcase_14 AC 129 ms
55,768 KB
testcase_15 AC 126 ms
56,112 KB
testcase_16 AC 131 ms
55,520 KB
testcase_17 AC 139 ms
55,808 KB
testcase_18 AC 139 ms
55,524 KB
testcase_19 AC 138 ms
56,108 KB
testcase_20 AC 137 ms
56,056 KB
testcase_21 AC 139 ms
55,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] ind = new int[N];
        int ans = N;
        while(M-->0){
            sc.next();
            int B = sc.nextInt()-1;
            if(ind[B]++==0)
                --ans;
        }
        System.out.println(ans);
    }
}
0