結果
問題 | No.527 ナップサック容量問題 |
ユーザー | 👑 testestest |
提出日時 | 2017-06-20 12:03:13 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 285 bytes |
コンパイル時間 | 360 ms |
コンパイル使用メモリ | 28,672 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 03:48:21 |
合計ジャッジ時間 | 1,883 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 3 ms
6,820 KB |
testcase_02 | AC | 2 ms
6,820 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 1 ms
6,820 KB |
testcase_05 | AC | 12 ms
6,820 KB |
testcase_06 | AC | 25 ms
6,820 KB |
testcase_07 | WA | - |
testcase_08 | AC | 11 ms
6,816 KB |
testcase_09 | AC | 2 ms
6,816 KB |
testcase_10 | WA | - |
testcase_11 | AC | 19 ms
6,816 KB |
testcase_12 | AC | 14 ms
6,816 KB |
testcase_13 | AC | 27 ms
6,816 KB |
testcase_14 | AC | 10 ms
6,816 KB |
testcase_15 | AC | 16 ms
6,820 KB |
testcase_16 | AC | 3 ms
6,816 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 3 ms
6,816 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 21 ms
6,816 KB |
testcase_23 | AC | 30 ms
6,820 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 30 ms
6,820 KB |
testcase_30 | AC | 4 ms
6,816 KB |
testcase_31 | WA | - |
testcase_32 | AC | 16 ms
6,824 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 17 ms
6,820 KB |
testcase_36 | AC | 2 ms
6,816 KB |
testcase_37 | AC | 13 ms
6,816 KB |
testcase_38 | AC | 16 ms
6,820 KB |
testcase_39 | AC | 15 ms
6,816 KB |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class 2 | a[1<<17],*d=a+100; | ^ main.c:2:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:2:11: warning: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] 2 | a[1<<17],*d=a+100; | ^ main.c:3:1: warning: data definition has no type or storage class 3 | v,w,n; | ^ main.c:3:1: warning: type defaults to 'int' in declaration of 'v' [-Wimplicit-int] main.c:3:3: warning: type defaults to 'int' in declaration of 'w' [-Wimplicit-int] 3 | v,w,n; | ^ main.c:3:5: warning: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] 3 | v,w,n; | ^ main.c:4:1: warning: data definition has no type or storage class 4 | i,j,t,m; | ^ main.c:4:1: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] main.c:4:3: warning: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 4 | i,j,t,m; | ^ main.c:4:5: warning: type defaults to 'int' in declaration of 't' [-Wimplicit-int] 4 | i,j,t,m; | ^ main.c:4:7: warning: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 4 | i,j,t,m; | ^ main.c:5:1: warning: return type defaults to 'int' [-Wimplicit-int] 5 | main(){ | ^~~~ main.c: In function 'main': main.c:6:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 6 | scanf("%d",&n); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #define INF 1e9 main.c:6:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 6 | scanf("%d",&n); | ^~~~~ main.c:6:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:10:41: warning: implicit declaration of function 'fmin' [-Wimplicit-function-declaration] 10 | for
ソースコード
#define INF 1e9 a[1<<17],*d=a+100; v,w,n; i,j,t,m; main(){ scanf("%d",&n); for(j=1;j<100010;j++)d[j]=INF; for(i=0;i<n;i++){ scanf("%d%d",&v,&w); for(j=100010;j;j--)d[j]=fmin(d[j],d[j-v]+w); } scanf("%d",&t); printf("%d\n",d[t]?:1); printf(d[t+1]==INF?"inf":"%d",d[t+1]-1); }