結果

問題 No.29 パワーアップ
ユーザー kyuna
提出日時 2019-08-06 08:53:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 403 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 70,656 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 13:51:21
合計ジャッジ時間 1,133 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> cnt(11, 0);
    while (n--) {
        int a, b, c; cin >> a >> b >> c;
        cnt[a]++, cnt[b]++, cnt[c]++;
    }
    int ans = 0;
    int rest = 0;
    for (int &ci: cnt) {
        ans += ci / 2, rest += ci %= 2;
    }
    cout << ans + rest / 4 << endl;
    return 0;
}
0