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