結果

問題 No.182 新規性の虜
ユーザー akichiakichi
提出日時 2017-08-24 00:26:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 4,507 ms
コンパイル使用メモリ 102,160 KB
実行使用メモリ 28,572 KB
最終ジャッジ日時 2023-08-27 16:27:57
合計ジャッジ時間 6,072 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
23,688 KB
testcase_01 AC 62 ms
21,596 KB
testcase_02 AC 62 ms
21,696 KB
testcase_03 AC 63 ms
23,596 KB
testcase_04 AC 63 ms
23,708 KB
testcase_05 AC 63 ms
21,588 KB
testcase_06 AC 61 ms
19,528 KB
testcase_07 AC 63 ms
21,668 KB
testcase_08 AC 104 ms
28,492 KB
testcase_09 AC 125 ms
28,572 KB
testcase_10 AC 119 ms
27,976 KB
testcase_11 AC 109 ms
26,832 KB
testcase_12 AC 87 ms
25,488 KB
testcase_13 AC 62 ms
21,464 KB
testcase_14 AC 64 ms
23,712 KB
testcase_15 AC 61 ms
21,648 KB
testcase_16 AC 63 ms
21,648 KB
testcase_17 AC 62 ms
21,644 KB
testcase_18 AC 109 ms
26,652 KB
testcase_19 AC 98 ms
21,308 KB
testcase_20 AC 87 ms
22,696 KB
testcase_21 AC 114 ms
24,908 KB
testcase_22 AC 91 ms
23,476 KB
testcase_23 AC 60 ms
23,656 KB
testcase_24 AC 114 ms
28,016 KB
testcase_25 AC 105 ms
28,224 KB
testcase_26 AC 77 ms
22,508 KB
testcase_27 AC 62 ms
19,532 KB
evil01.txt AC 122 ms
29,468 KB
evil02.txt AC 122 ms
29,436 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
class Program {
    static void Main() {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToList();
        a.Sort();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans++;
            if (i == n - 1) break;
            if (a[i] == a[i + 1]) {
                ans--;
                do {
                    i++;
                    if (i == n - 1) break;
                } while (a[i] == a[i + 1]);
            }
        }
        Console.WriteLine(ans);
    }
}
0