結果
問題 | No.489 株に挑戦 |
ユーザー | tails |
提出日時 | 2017-02-24 23:57:34 |
言語 | C90 (gcc 11.4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 676 bytes |
コンパイル時間 | 154 ms |
コンパイル使用メモリ | 21,248 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-10 23:36:06 |
合計ジャッジ時間 | 2,436 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 13 ms
5,248 KB |
testcase_01 | AC | 11 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | RE | - |
testcase_17 | AC | 3 ms
5,376 KB |
testcase_18 | AC | 10 ms
5,376 KB |
testcase_19 | AC | 8 ms
5,376 KB |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | AC | 3 ms
5,376 KB |
testcase_23 | AC | 8 ms
5,376 KB |
testcase_24 | AC | 21 ms
5,376 KB |
testcase_25 | AC | 1 ms
5,376 KB |
testcase_26 | AC | 20 ms
5,376 KB |
testcase_27 | AC | 19 ms
5,376 KB |
testcase_28 | AC | 2 ms
5,376 KB |
testcase_29 | AC | 1 ms
5,376 KB |
testcase_30 | RE | - |
testcase_31 | AC | 20 ms
5,376 KB |
testcase_32 | AC | 12 ms
5,376 KB |
testcase_33 | AC | 20 ms
5,376 KB |
testcase_34 | AC | 18 ms
5,376 KB |
testcase_35 | AC | 8 ms
5,376 KB |
testcase_36 | AC | 4 ms
5,376 KB |
testcase_37 | RE | - |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | X[0x40000]; | ^ main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘X’ [-Wimplicit-int] main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 3 | f(i,j){ | ^ main.c: In function ‘f’: main.c:3:1: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int] main.c:3:1: warning: type of ‘j’ defaults to ‘int’ [-Wimplicit-int] main.c: In function ‘main’: main.c:24:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 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:24:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 24 | scanf("%d%d%d",&n,&d,&k); | ^~~~~ main.c:24:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:48:17: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 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’ main.c:48:17: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] main.c:48:17: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:50:17: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration] 50 | puts("0"); | ^~~~ main.c:50:17: note: include ‘<stdio.h>’ or provide a declaration of ‘puts’
ソースコード
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; }