結果

問題 No.489 株に挑戦
ユーザー Yut176
提出日時 2017-02-24 23:30:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 719 bytes
コンパイル時間 762 ms
コンパイル使用メモリ 85,228 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-01-03 00:29:40
合計ジャッジ時間 20,598 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 15 WA * 12 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;


int main(){

  int n, d, k;
  cin >> n >> d >> k;
  vector<int> x(n);
  for(int i=0; i<n; i++) cin >> x[i];

  int lmax = 0;
  int rmax = 0;
  int diffmax = 0;
  int r = 0;
  for(int l=0; l<n; l++){
    r = l;
    while(r - l <= d){
      if( r >= n ) break;

      if( diffmax < x[r] - x[l] ){
        lmax = l;
        rmax = r;
        diffmax = x[r] - x[l];
      }

      r++;
    }

  }

  long long int ans = diffmax * k;
  cout << ans << endl;
  cout << lmax << " " << rmax << endl;

  return 0;
}
0