結果
問題 | No.190 Dry Wet Moist |
ユーザー |
![]() |
提出日時 | 2022-12-26 01:59:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 355 ms / 2,000 ms |
コード長 | 1,075 bytes |
コンパイル時間 | 970 ms |
コンパイル使用メモリ | 118,712 KB |
最終ジャッジ日時 | 2025-02-09 21:00:48 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
ソースコード
#include <iostream>#include <vector>#include <cmath>#include <map>#include <set>#include <iomanip>#include <queue>#include <algorithm>#include <numeric>#include <deque>#include <complex>#include <cassert>using namespace std;int main(){int N, A, dry=0, moist=0, wet=0;cin >> N;multiset<int> st, ts;map<int, int> mp;for (int i=0; i<N*2; i++){cin >> A;st.insert(A);mp[A]++;}ts = st;while(1){if (ts.size() <= 1) break;if (*ts.begin() + *ts.rbegin() > 0){ts.erase(ts.find(*ts.rbegin()));wet++;}ts.erase(ts.begin());}ts = st;while(1){if (ts.size() <= 1) break;if (*ts.begin() + *ts.rbegin() < 0){ts.erase(ts.begin());dry++;}ts.erase(ts.find(*ts.rbegin()));}for (auto [x, y] : mp){if (x < 0) moist += min(y, mp[-x]);if (x == 0) moist += y/2;}cout << dry << " " << wet << " " << moist << endl;return 0;}