結果

問題 No.489 株に挑戦
ユーザー kkty
提出日時 2017-11-07 09:29:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 1,246 ms
コンパイル使用メモリ 164,532 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-11-24 04:33:12
合計ジャッジ時間 3,501 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 3 WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 30);
typedef pair<ll,ll> pii;
typedef vector<vector<ll>> Graph;
typedef vector<pii> vpii;
int main() {
  ll N,D,K; cin>>N>>D>>K;
  vi x(N); REP(i,N) cin>>x[i];
  multiset<ll> S;
  ll ans=0;
  REP(i,D) {
    if(S.begin()!=S.end()) ans=max(ans,x[i]-*S.begin());
    S.insert(x[i]);
  }

  FOR(i,D,N) {
    ans=max(ans,x[i]-*S.begin());
    S.insert(x[i]);
    S.erase(S.find(x[i-D]));
  }

  cout<<ans*K<<endl;


}
0