結果

問題 No.489 株に挑戦
コンテスト
ユーザー ciel
提出日時 2017-03-03 02:43:51
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 523 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 349 ms
コンパイル使用メモリ 41,632 KB
最終ジャッジ日時 2026-02-21 23:29:22
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 15 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <stdio.h>
//yukicoder does not support C99
int x[100000];
int main(){
	int n,d,k,r,s;
	scanf("%d%d%d",&n,&d,&k);
	for(int i=0;i<n;i++)scanf("%d",x+i);
	for(int i=0;i<n;i++){
		int e=d+1;
		int f=x[i];
		if(e>n-i)e=n-i;
		for(int j=0;j<e;j++)if(f<x[i+j])f=x[i+j];
		if(r<f-x[i])r=f-x[i],s=i;
	}
	if(r==0)puts("0");
	else{
		int e=d+1;
		if(e>n-s)e=n-s;
		for(int j=0;j<e;j++)if(r==x[s+j]-x[s]){
			printf("%lld\n%d %d\n",(long long)r*k,s,s+j);
			break;
		}
	}
}
0