結果
問題 |
No.489 株に挑戦
|
ユーザー |
|
提出日時 | 2017-02-27 00:55:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 32,000 KB |
実行使用メモリ | 10,268 KB |
最終ジャッジ日時 | 2024-06-11 16:58:56 |
合計ジャッジ時間 | 3,781 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 16 TLE * 2 -- * 17 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:20:31: warning: 's' may be used uninitialized [-Wmaybe-uninitialized] 20 | printf("%lld\n%d %d\n",(long long)r*k,s,s+j); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:5:21: note: 's' was declared here 5 | int n,d,k,r,s; | ^ main.cpp:20:48: warning: 'r' may be used uninitialized [-Wmaybe-uninitialized] 20 | printf("%lld\n%d %d\n",(long long)r*k,s,s+j); | ^~~~~~~~~~~~ main.cpp:5:19: note: 'r' was declared here 5 | int n,d,k,r,s; | ^
ソースコード
#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; } } }