結果

問題 No.489 株に挑戦
ユーザー Yut176Yut176
提出日時 2017-02-24 23:27:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 83,312 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-31 00:03:41
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 AC 4 ms
4,380 KB
testcase_18 WA -
testcase_19 RE -
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
testcase_31 RE -
testcase_32 WA -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
権限があれば一括ダウンロードができます

ソースコード

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++){

    while(r - l <= d){

      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