結果

問題 No.29 パワーアップ
ユーザー shi-mo
提出日時 2016-04-05 01:57:44
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 1,446 ms
コンパイル使用メモリ 138,044 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 03:23:40
合計ジャッジ時間 2,156 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;

void main() {
    int n; readf("%s\n", &n);

    short[] c; c.length = 11;
    int ans = 0, nonPaired = 0;
    foreach (_; 0..n) {
        short[3] a; readf("%s %s %s\n", &a[0], &a[1], &a[2]);
        foreach (i; a) {
            if (0 == c[i]) {
                ++c[i];
                ++nonPaired;
                continue;
            }
            ++ans;
            --nonPaired;
            c[i] = 0;
        }
    }
    ans += nonPaired/4;
    writeln(ans);
}
0