結果

問題 No.29 パワーアップ
ユーザー Shirakami4LFE
提出日時 2022-12-28 17:29:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 625 bytes
コンパイル時間 1,788 ms
コンパイル使用メモリ 169,920 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 18:51:24
合計ジャッジ時間 2,492 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N; cin >> N;
    vector<int>items(N*3);
    
    for(int i=0; i<N*3; i++){
        cin >> items.at(i);
    }
    
    vector<int>itemnums(10);
    for(int i=0; i<10; i++){
        itemnums.at(i)=count(items.begin(),items.end(),i+1);
    }
    
    int countup=0; int remain=0;
    for(int i=0; i<10; i++){
        int temp=itemnums.at(i);
        
        if(temp%2==0){
            countup+=temp/2;
        }
        else{
            countup+=temp/2;
            remain++;
        }
        
    }
    cout << countup+remain/4 << endl;
    return 0;
}
    
0