結果
| 問題 |
No.489 株に挑戦
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2017-02-24 23:57:34 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 676 bytes |
| コンパイル時間 | 846 ms |
| コンパイル使用メモリ | 37,760 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-03 00:55:45 |
| 合計ジャッジ時間 | 2,826 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 RE * 5 |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
1 | X[0x40000];
| ^
main.c: In function 'main':
main.c:24:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
24 | scanf("%d%d%d",&n,&d,&k);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | X[0x40000];
main.c:48:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
48 | printf("%lld\n%d %d\n",1ll*b*k,j0,j1);
| ^~~~~~
main.c:48:17: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
X[0x40000];
f(i,j){
int b=1e9;
while(i<=j){
if(i&1){
if(b>X[i])b=X[i];
++i;
}
if(!(j&1)){
if(b>X[j])b=X[j];
--j;
}
i=0x20000|i>>1;
j=0x20000|j>>1;
}
return b;
}
int main(){
int i,j,n,d,k,b;
int j0,j1;
scanf("%d%d%d",&n,&d,&k);
for(i=0;i<n;++i){
scanf("%d",&X[i]);
}
for(i=0;i<0x20000;++i){
int x0=X[i<<1|0];
int x1=X[i<<1|1];
X[i|0x20000]=x0<x1?x0:x1;
}
b=0;
for(i=0;i<n;++i){
int z=f(j=i-d<0?0:i-d,i);
int c=X[i]-f(j=i-d<0?0:i-d,i);
if(b<c) b=c,j1=i;
}
if(b){
for(i=j1-d;i<j1;++i){
if (b==X[j1]-X[i]){
j0=i;
break;
}
}
printf("%lld\n%d %d\n",1ll*b*k,j0,j1);
}else{
puts("0");
}
return 0;
}
tails