結果

問題 No.182 新規性の虜
コンテスト
ユーザー shi-mo
提出日時 2016-04-03 18:45:47
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 342 bytes
コンパイル時間 1,455 ms
コンパイル使用メモリ 139,864 KB
実行使用メモリ 10,756 KB
最終ジャッジ日時 2024-06-12 03:21:18
合計ジャッジ時間 3,104 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.string;
import std.algorithm;

void main() {
    int n; readf("%s\n", &n);
    string[] a = readln.strip.split;

    int ans = n;
    int[string] c;
    foreach (ai; a) {
        if (!(ai in c)) c[ai] = 0;
        ++c[ai];
        if (2 == c[ai]) ans -= 2;
        if (2 < c[ai]) --ans;
    }
    writeln(ans);
}
0