結果

問題 No.190 Dry Wet Moist
ユーザー srjywrdnprkt
提出日時 2022-12-26 01:53:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,149 bytes
コンパイル時間 1,076 ms
コンパイル使用メモリ 111,548 KB
最終ジャッジ日時 2025-02-09 21:00:41
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    for (int i=0; i<N*2; i++){
        cin >> A;
        st.insert(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()));
    }

    ts = st; 
    while(1){
        if (ts.size() <= 1) break;
        if (*ts.begin() + *ts.rbegin() == 0){ 
            ts.erase(ts.find(*ts.rbegin()));
            moist++;
        }   
        ts.erase(ts.begin());
    }

    cout << dry << " " << wet << " " << moist << endl;

    return 0;
}
0