結果

問題 No.489 株に挑戦
ユーザー rapurasurapurasu
提出日時 2017-02-24 23:13:49
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 977 bytes
コンパイル時間 1,925 ms
コンパイル使用メモリ 153,580 KB
実行使用メモリ 10,392 KB
最終ジャッジ日時 2023-08-30 23:46:40
合計ジャッジ時間 6,635 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL N,D,K;
LL X[100001];
map<LL,int>m;
int main(){
	cin>>N>>D>>K;
	REP(i,N){
	   cin>>X[i];
	}
	LL ans=0;
	int mi=-1;
	int ma=-1;
	int num=-1;
	REP(i,N){
	    if(D<i){
	       m[X[i-(D+1)]]--;
	       if(m[X[i-(D+1)]]<=0)m.erase(X[i-(D+1)]);
	    }
	    if(m.find(X[i])==m.end()){
	       m[X[i]]=1;
	    }else{
	       m[X[i]]++;
	    }
	    LL temp=m.begin()->first;
	    if(X[i]-temp>ans){
	       num=i;
	       ma=X[i];
	       mi=temp;
	       ans=ma-mi;
	    }
	}
	if(ma==-1){
	   cout<<0<<endl;
	   return 0;
        }
        cout<<ans*K<<endl;
        for(int i=max(0,int(num-D));i<=num;i--){
            if(X[i]==mi){
               cout<<i<<" "<<num<<endl;
               return 0;
            }
        }
	return(0);
}
0