結果
問題 | No.120 傾向と対策:門松列(その1) |
ユーザー | nmnmnmnmnmnmnm |
提出日時 | 2015-01-08 23:37:29 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 62 ms / 5,000 ms |
コード長 | 1,140 bytes |
コンパイル時間 | 2,073 ms |
コンパイル使用メモリ | 99,144 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-03 22:42:59 |
合計ジャッジ時間 | 1,625 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 51 ms
4,376 KB |
testcase_01 | AC | 61 ms
4,380 KB |
testcase_02 | AC | 29 ms
4,376 KB |
testcase_03 | AC | 62 ms
4,376 KB |
ソースコード
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(int i=(a);i<(b);++i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define MOD 1000000009 int main(){ int t; cin>>t; rep(a,0,t){ int n; cin>>n; map<int,int> ma; rep(i,0,n){ int b; cin>>b; ma[b]++; } map<int,int>::iterator itr = ma.begin(); vector<int> v; while(itr!=ma.end()){ v.pb((*itr).se); itr++; } v.pb(0); v.pb(0); v.pb(0); int ans = 0; for(;;){ sort(all(v),greater<int>()); if(v[2]==0)break; ans++; v[0]--; v[1]--; v[2]--; } cout << ans <<endl; } return 0; }