結果
問題 |
No.120 傾向と対策:門松列(その1)
|
ユーザー |
![]() |
提出日時 | 2015-08-02 02:39:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 491 bytes |
コンパイル時間 | 787 ms |
コンパイル使用メモリ | 76,188 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-07-18 00:45:18 |
合計ジャッジ時間 | 1,520 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 4 |
ソースコード
#include<iostream> #include<map> #include<queue> #define REP(i,n) for(int i=0;i<n;++i) using namespace std; int main(){ int t; cin >> t; while (t--){ map<int, int> mp; int n; cin >> n; REP(i,n){ int l; cin >> l; mp[l]++; } priority_queue<int> pq; for (auto it : mp) pq.push(it.second); int ans = 0; while (pq.size() >= 3){ ans++; int x[3]; REP(i, 3) pq.top(), pq.pop(); REP(i, 3) if (x[i] > 1) pq.push(x[i] - 1); } cout << ans << endl; } return 0; }