結果
| 問題 |
No.1736 Princess vs. Dragoness
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-15 10:44:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 852 bytes |
| コンパイル時間 | 674 ms |
| コンパイル使用メモリ | 75,876 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-15 10:44:14 |
| 合計ジャッジ時間 | 1,928 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d%d%d%lld%lld",&n,&a,&b,&x,&y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | scanf("%d",&h[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
int n,a,b;
ll x,y;
int main(){
int i,j,cnt;
ll p,d;
scanf("%d%d%d%lld%lld",&n,&a,&b,&x,&y);
vector<int> h(n);
vector<P> hh(n);
cnt=n;
rep(i,n){
scanf("%d",&h[i]);
hh[i].first=h[i];
hh[i].second=i;
}
sort(hh.rbegin(),hh.rend());
rep(i,n){
j=(h[hh[i].second]+x-1)/x;
h[hh[i].second]-=x*min(a,j);
a-=min(a,j);
if(h[hh[i].second]<=0)cnt--;
}
p=y*b;
rep(i,n){
if(h[i]>0){
d=min((ll)h[i],p);
h[i]-=d;
p-=d;
if(h[i]<=0)cnt--;
}
}
printf("%s\n",cnt==0?"Yes":"No");
return 0;
}