結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-12 05:10:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 616 bytes |
| コンパイル時間 | 1,297 ms |
| コンパイル使用メモリ | 82,964 KB |
| 最終ジャッジ日時 | 2025-01-09 17:37:35 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using lint = long long;
void solve() {
std::map<int, int> cnt;
int n;
std::cin >> n;
for (int i = 0; i < n; ++i) {
int x;
std::cin >> x;
if (!cnt.count(x)) cnt[x] = 0;
++cnt[x];
}
int max = 0;
for (auto p : cnt) {
max = std::max(max, p.second);
}
std::cout << std::min(n / 3, (n - max) / 2) << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int q;
std::cin >> q;
while (q--) solve();
return 0;
}