結果
| 問題 |
No.489 株に挑戦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-03 02:43:51 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 375 ms |
| コンパイル使用メモリ | 29,056 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-21 17:26:59 |
| 合計ジャッジ時間 | 5,790 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 15 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d%d%d",&n,&d,&k);
| ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:9:29: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | for(int i=0;i<n;i++)scanf("%d",x+i);
| ^~~~~~~~~~~~~~~
ソースコード
#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;
}
}
}