結果
問題 |
No.489 株に挑戦
|
ユーザー |
![]() |
提出日時 | 2017-02-24 23:34:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 737 bytes |
コンパイル時間 | 1,131 ms |
コンパイル使用メモリ | 85,316 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 00:32:50 |
合計ジャッジ時間 | 2,610 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 29 |
ソースコード
#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; if( ans != 0 ) cout << lmax << " " << rmax << endl; return 0; }