結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
ninoinui
|
| 提出日時 | 2020-11-21 22:11:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 958 bytes |
| コンパイル時間 | 2,009 ms |
| コンパイル使用メモリ | 195,960 KB |
| 最終ジャッジ日時 | 2025-01-16 04:14:11 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U> bool cmin(T &a, U b) { return a > b && (a = b, true); }
template <typename T, typename U> bool cmax(T &a, U b) { return a < b && (a = b, true); }
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
multiset<int> MS;
for (int i = 0; i < N; i++) {
int L;
cin >> L;
MS.insert(L);
}
int ans = 0, now = -1;
while (MS.size()) {
auto it = --MS.end();
now = *it;
MS.erase(it);
if (!MS.size()) break;
it = MS.lower_bound(now);
if (it == MS.begin()) break;
it--;
now = *it;
MS.erase(it);
if (!MS.size()) break;
it = MS.lower_bound(now);
if (it == MS.begin()) break;
it--;
now = *it;
MS.erase(it);
ans++;
}
cout << ans << "\n";
}
}
ninoinui