結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー 👑 naipianaipia
提出日時 2018-06-20 22:19:08
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 483 bytes
コンパイル時間 1,261 ms
コンパイル使用メモリ 148,248 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 07:24:12
合計ジャッジ時間 2,681 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int t,n,in;
    cin >> t;
    for(int i=0;i<t;i++){
        vector<int> v(101,0);
        cin >> n;
        for(int j=0;j<n;j++) cin>>in,v[in]++;
        sort(v.begin(),v.end(),greater<int>());
        int cnt=0;
        while(v[0]!=0&&v[1]!=0&&v[2]!=0){
            cnt+=v[2];v[0]-=v[2];v[1]-=v[2];v[2]=0;
            sort(v.begin(),v.end(),greater<int>());
        }
        cout << cnt << endl;
    }

    return 0;
}
0