結果

問題 No.190 Dry Wet Moist
ユーザー CleyLCleyL
提出日時 2023-06-19 16:40:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 94,356 KB
実行使用メモリ 13,148 KB
最終ジャッジ日時 2023-09-09 12:02:33
合計ジャッジ時間 3,922 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 154 ms
12,236 KB
testcase_23 AC 197 ms
13,148 KB
testcase_24 AC 140 ms
7,716 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 45 ms
6,652 KB
testcase_29 AC 60 ms
7,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(){
  int n;cin>>n;n*=2;
  vector<int> A(n);
  map<int,int> B;
  for(int i = 0; n > i; i++){
    cin>>A[i];
    B[A[i]]++;
  }
  
  sort(A.begin(), A.end());
  int nw = n-1;
  int dry = 0;
  for(int i = 0; i < nw ; i++){
    while(i < nw && A[i]+A[nw] >= 0)nw--;
    if(i < nw)dry++;
    nw--;
  }
  nw = 0;
  int wet = 0;
  for(int i = n-1; nw < i; i--){
    while(nw < i && A[nw]+A[i] <= 0)nw++;
    if(nw < i)wet++;
    nw++;
  }
  int moist = 0;
  for(auto x: B){
    if(x.first <= 0)continue;
    moist += min(x.second, B[-x.first]);
  }
  cout << dry << " " << wet << " " << moist << endl;
}
0