結果
問題 |
No.1071 ベホマラー
|
ユーザー |
|
提出日時 | 2020-06-05 21:31:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 70,768 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-17 13:31:51 |
合計ジャッジ時間 | 2,064 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 13 WA * 7 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int N,K,X,Y; long A[1<<17]; main() { cin>>N>>K>>X>>Y; long S=0; for(int i=0;i<N;i++) { cin>>A[i]; S+=A[i]=(A[i]-1+K-1)/K; } long ans=S*X; sort(A,A+N); long pre=0; for(int i=0;i<N;i++) { S-=(A[i]-pre)*(N-i); pre=A[i]; ans=min(ans,S*X+A[i]*Y); } cout<<ans<<endl; }