結果
問題 |
No.489 株に挑戦
|
ユーザー |
![]() |
提出日時 | 2017-02-24 23:27:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 681 bytes |
コンパイル時間 | 897 ms |
コンパイル使用メモリ | 85,388 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 00:24:03 |
合計ジャッジ時間 | 2,972 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 2 WA * 32 RE * 1 |
ソースコード
#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; }