結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー akiduki_104akiduki_104
提出日時 2021-03-31 21:40:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,359 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 174,492 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-09 06:10:13
合計ジャッジ時間 3,422 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 28 ms
5,376 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 RE -
testcase_19 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using intt = int64_t;
intt sum(const long &a, const long &b) { return (a + b) * (b - a + 1) / 2; }
vector<char> alphabet={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int main() {
cout << fixed << setprecision(10);
  int n,m,x,y;
  cin>>n>>m>>x>>y;
  vector<int> a(n);
  rep(i,n){
      cin>>a.at(i);
  }
  int c1=0;
  rep(i,n){
      if(a.at(i)>=x){
          c1++;
      }
  }
  int c2=0;
  rep(i,n){
      if(a.at(i)<x&&a.at(i)>y){
          c2++;
          
      }
  }
  int cx=0;
  rep(i,n){
    if(a.at(i)<=y){
      cx++;
    }
  }
  if(c1>m){
      cout<<"Handicapped"<<endl;
  }
  else if(c1+cx==n){
    int iine=0;
    rep(i,n){
      if(a.at(i)>=x){
          iine+=a.at(i);
      }
  }
    cout<<iine<<endl;
  }
  else{
      int iine=0;
      vector<int> b(c2);
      rep(i,n){
          if(a.at(i)>=x){
              iine+=a.at(i);
          }
      }
    
        int i=0;
      rep(j,n){
              if(a.at(j)<x&&a.at(j)>y){
                  b.at(i)=a.at(j);
                i++;
              }
      }
      sort(b.begin(),b.end());
      reverse(b.begin(),b.end());
      int c3=m-c1;
      rep(i,c3){
          iine+=b.at(i);
          
      }
      cout<<iine<<endl;
  }
}
0