結果
問題 | No.1071 ベホマラー |
ユーザー | Mi |
提出日時 | 2020-06-06 15:47:38 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,328 bytes |
コンパイル時間 | 2,302 ms |
コンパイル使用メモリ | 207,764 KB |
実行使用メモリ | 7,296 KB |
最終ジャッジ日時 | 2024-12-23 12:54:29 |
合計ジャッジ時間 | 3,382 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 1 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 17 ms
6,016 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 24 ms
7,040 KB |
testcase_18 | AC | 22 ms
7,040 KB |
testcase_19 | AC | 24 ms
7,168 KB |
testcase_20 | AC | 17 ms
7,168 KB |
testcase_21 | WA | - |
testcase_22 | AC | 17 ms
7,168 KB |
testcase_23 | AC | 18 ms
7,168 KB |
testcase_24 | AC | 23 ms
7,168 KB |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54, from main.cpp:1: In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]', inlined from 'int main()' at main.cpp:55:11: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:44:8: note: 'ans' was declared here 44 | ll ans; | ^~~
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> P; typedef pair<int,int> Pi; #define rep(i,n) for(ll i=0;i<n;i++) #define FOR(i,a,b) for(ll i=a;i<b;i++) #define fi first #define se second #define endl "\n" template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;} template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;} template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";} template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";} template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;} template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;} template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;} const ll mod=1e9+7; const ll inf=1e17; const int INF=1e9; const double EPS=1e-10; const double PI=acos(-1); int main(){ cin.tie(0);ios::sync_with_stdio(false); ll n,k,x,y; cin>>n>>k>>x>>y; vector<ll> a(n); vector<__int128_t> cnt(n),sum(n+1,0); rep(i,n){ cin>>a[i]; a[i]--; cnt[i]=(a[i]+k-1)/k; } sort(begin(cnt),end(cnt)); rep(i,n){ sum[i+1]=sum[i]+cnt[i]; } ll ans; rep(i,n+1){//i-1まで全体魔法で消す __int128_t now; if(i){ now=cnt[i-1]*y+(sum[n]-sum[i]-cnt[i-1]*(n-i))*x; if(now<(1ll<<61)) chmin(ans,ll(now)); }else{ now=sum[n]*x; if(now<(1ll<<61)) ans=now; } } cout<<ans<<endl; }