結果

問題 No.29 パワーアップ
ユーザー Tatsu_mr
提出日時 2024-10-02 23:21:59
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 542 bytes
コンパイル時間 2,553 ms
コンパイル使用メモリ 245,032 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-10-02 23:22:07
合計ジャッジ時間 3,281 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;

using lint = long long;

int main() {
    int n;
    cin >> n;
    vector<int> cnt(10);
    rep(i, n) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        c--;
        cnt[a]++;
        cnt[b]++;
        cnt[c]++;
    }
    int ans = 0;
    rep(i, 10) {
        ans += cnt[i] / 2;
        cnt[i] %= 2;
    }
    ans += accumulate(ALL(cnt), 0) / 4;
    cout << ans << endl;
}
0