結果
問題 | No.120 傾向と対策:門松列(その1) |
ユーザー |
![]() |
提出日時 | 2015-07-23 04:23:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 60 ms / 5,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 1,431 ms |
コンパイル使用メモリ | 173,496 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-08 12:11:36 |
合計ジャッジ時間 | 2,626 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; map<int, int> m; for (int i = 0; i < n; ++i) { int l; cin >> l; ++m[l]; } vector<int> v = {0, 0, 0}; for (auto i : m) v.emplace_back(i.second); sort(v.rbegin(), v.rend()); int res = 0; while (v[2] > 0) { for (int i = 0; i < 3; ++i) --v[i]; sort(v.rbegin(), v.rend()); ++res; } cout << res << endl; } int main() { int t; cin >> t; for (int i = 0; i < t; ++i) solve(); }