結果

問題 No.489 株に挑戦
ユーザー dekueuedekueue
提出日時 2017-03-04 16:35:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 812 bytes
コンパイル時間 917 ms
コンパイル使用メモリ 108,444 KB
実行使用メモリ 11,232 KB
最終ジャッジ日時 2023-09-05 05:27:07
合計ジャッジ時間 3,881 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,468 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 57 ms
7,232 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 64 ms
7,660 KB
testcase_21 AC 15 ms
5,404 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 57 ms
10,496 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 87 ms
11,232 KB
testcase_31 AC 60 ms
11,096 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 10 ms
4,928 KB
testcase_37 AC 38 ms
7,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<stack>
#include<queue>
#include<numeric>
#include<algorithm>
#include<string>
#include<random>
#include<map>
#include<bitset>
#include<set>
#include<cmath>
#define int long long
const int inf=1145141919;
int mod;
const int dd[]={0,-1,0,1,0};
using namespace std;
int p[100000];
signed main(){
	int n,d,k;
	int i;
	cin>>n>>d>>k;
	d++;
	for(i=0;i<n;i++)
		cin>>p[i];
	set<pair<int,int> > ki;
	set<pair<int,int> >::iterator q[100000];
	for(i=0;i<d;i++)
		q[i]=ki.insert(make_pair(p[i],-i)).first;
	int ans=0,u=0,v=0;
	for(i=0;i<n;i++){
		auto x=*rbegin(ki);
		auto z=x.first-p[i];
		if(z>ans){
			ans=z;
			u=i;
			v=-x.second;
		}
		ki.erase(q[i]);
		if(i<n-d)
			q[i+d]=ki.insert(make_pair(p[i+d],-i)).first;
	}
	cout<<ans*k<<endl;
	if(ans)
		cout<<u<<" "<<v<<endl;
}
0