結果
問題 | No.472 平均順位 |
ユーザー | Yamyuki |
提出日時 | 2016-12-22 08:57:04 |
言語 | C90 (gcc 11.4.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 354 ms |
コンパイル使用メモリ | 22,784 KB |
実行使用メモリ | 435,820 KB |
最終ジャッジ日時 | 2024-05-08 10:56:17 |
合計ジャッジ時間 | 2,186 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 4 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 5 ms
5,376 KB |
testcase_09 | AC | 19 ms
10,752 KB |
testcase_10 | AC | 28 ms
13,568 KB |
testcase_11 | AC | 55 ms
29,824 KB |
testcase_12 | AC | 27 ms
27,136 KB |
testcase_13 | MLE | - |
testcase_14 | MLE | - |
testcase_15 | MLE | - |
testcase_16 | MLE | - |
testcase_17 | MLE | - |
testcase_18 | WA | - |
testcase_19 | MLE | - |
コンパイルメッセージ
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",&n,&p); | ^~~~~~~~~~~~~~~~~~~~ main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%ld %ld %ld",&a[i],&b[i],&c[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) long dp[5000][15001]; long a[5000],b[5000],c[5000]; int main(){ int i,n,p,j; scanf("%d %d",&n,&p); for(i=0;i<n;i++){ scanf("%ld %ld %ld",&a[i],&b[i],&c[i]); } dp[0][0]=a[0]; dp[0][1]=b[0]; dp[0][2]=c[0]; dp[0][3]=1; for(i=1;i<n;i++){ for(j=max(0,p-(n-i)*3);j<=min(p,(i+1)*3);j++){ dp[i][j]=dp[i-1][j]+a[i]; if(j==0) continue; dp[i][j]=min(dp[i][j],dp[i-1][j-1]+b[i]); if(j==1) continue; dp[i][j]=min(dp[i][j],dp[i-1][j-2]+c[i]); if(j==2) continue; dp[i][j]=min(dp[i][j],dp[i-1][j-3]+1); } } printf("%f\n",(double)dp[n-1][p]/(double)n); return 0; }