結果

問題 No.29 パワーアップ
コンテスト
ユーザー shi-mo
提出日時 2016-04-05 01:57:44
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 1,533 ms
コンパイル使用メモリ 124,736 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-24 20:56:55
合計ジャッジ時間 2,216 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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