結果
| 問題 |
No.1454 ツブ消ししとるなEasy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 21:04:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 427 bytes |
| コンパイル時間 | 781 ms |
| コンパイル使用メモリ | 76,436 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-15 09:09:12 |
| 合計ジャッジ時間 | 1,768 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N,M,X,Y;
main()
{
cin>>N>>M>>X>>Y;
long ans=0;
vector<int>T;
for(int i=0;i<N;i++)
{
int A;cin>>A;
if(A>=X)
{
ans+=A;
M--;
}
else if(A>Y)T.push_back(A);
}
if(M<0)cout<<"Handicapped"<<endl;
else
{
sort(T.begin(),T.end());
reverse(T.begin(),T.end());
for(int i=0;i<T.size()&&i<M;i++)ans+=T[i];
cout<<ans<<endl;
}
}