結果

問題 No.489 株に挑戦
ユーザー rapurasurapurasu
提出日時 2017-02-24 23:14:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 108 ms / 1,000 ms
コード長 977 bytes
コンパイル時間 1,481 ms
コンパイル使用メモリ 153,552 KB
実行使用メモリ 10,340 KB
最終ジャッジ日時 2023-09-27 05:06:13
合計ジャッジ時間 4,253 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
4,380 KB
testcase_01 AC 46 ms
5,644 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 52 ms
4,644 KB
testcase_17 AC 6 ms
4,380 KB
testcase_18 AC 38 ms
4,380 KB
testcase_19 AC 25 ms
4,492 KB
testcase_20 AC 100 ms
6,796 KB
testcase_21 AC 18 ms
4,684 KB
testcase_22 AC 8 ms
4,380 KB
testcase_23 AC 36 ms
4,380 KB
testcase_24 AC 108 ms
6,796 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 71 ms
9,804 KB
testcase_27 AC 29 ms
4,380 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 99 ms
10,124 KB
testcase_31 AC 70 ms
10,340 KB
testcase_32 AC 47 ms
4,376 KB
testcase_33 AC 107 ms
6,368 KB
testcase_34 AC 82 ms
4,732 KB
testcase_35 AC 31 ms
4,432 KB
testcase_36 AC 11 ms
4,384 KB
testcase_37 AC 48 ms
6,248 KB
権限があれば一括ダウンロードができます

ソースコード

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