結果
問題 | No.527 ナップサック容量問題 |
ユーザー | 👑 testestest |
提出日時 | 2017-06-20 12:04:13 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 286 bytes |
コンパイル時間 | 112 ms |
コンパイル使用メモリ | 29,824 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 03:48:28 |
合計ジャッジ時間 | 1,520 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,820 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 3 ms
6,816 KB |
testcase_04 | AC | 2 ms
6,820 KB |
testcase_05 | AC | 13 ms
6,816 KB |
testcase_06 | AC | 27 ms
6,820 KB |
testcase_07 | AC | 21 ms
6,820 KB |
testcase_08 | AC | 12 ms
6,816 KB |
testcase_09 | AC | 2 ms
6,820 KB |
testcase_10 | AC | 27 ms
6,820 KB |
testcase_11 | AC | 19 ms
6,820 KB |
testcase_12 | AC | 13 ms
6,816 KB |
testcase_13 | AC | 27 ms
6,816 KB |
testcase_14 | AC | 11 ms
6,820 KB |
testcase_15 | AC | 16 ms
6,820 KB |
testcase_16 | AC | 2 ms
6,820 KB |
testcase_17 | AC | 13 ms
6,816 KB |
testcase_18 | AC | 15 ms
6,816 KB |
testcase_19 | AC | 2 ms
6,824 KB |
testcase_20 | AC | 11 ms
6,820 KB |
testcase_21 | AC | 30 ms
6,816 KB |
testcase_22 | AC | 20 ms
6,816 KB |
testcase_23 | AC | 29 ms
6,816 KB |
testcase_24 | AC | 7 ms
6,820 KB |
testcase_25 | AC | 21 ms
6,820 KB |
testcase_26 | AC | 18 ms
6,820 KB |
testcase_27 | AC | 18 ms
6,820 KB |
testcase_28 | AC | 15 ms
6,820 KB |
testcase_29 | AC | 30 ms
6,816 KB |
testcase_30 | AC | 4 ms
6,816 KB |
testcase_31 | AC | 13 ms
6,816 KB |
testcase_32 | AC | 16 ms
6,816 KB |
testcase_33 | AC | 15 ms
6,820 KB |
testcase_34 | AC | 17 ms
6,820 KB |
testcase_35 | AC | 16 ms
6,824 KB |
testcase_36 | AC | 3 ms
6,820 KB |
testcase_37 | AC | 14 ms
6,820 KB |
testcase_38 | AC | 15 ms
6,820 KB |
testcase_39 | AC | 14 ms
6,820 KB |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class 2 | a[1<<17],*d=a+1000; | ^ 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+1000; | ^ 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 | f
ソースコード
#define INF 1e9 a[1<<17],*d=a+1000; 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); }