結果
問題 | No.527 ナップサック容量問題 |
ユーザー | 👑 testestest |
提出日時 | 2017-06-20 12:02:37 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 285 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 29,696 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-10-02 03:48:19 |
合計ジャッジ時間 | 2,200 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 3 ms
6,820 KB |
testcase_02 | WA | - |
testcase_03 | AC | 3 ms
6,820 KB |
testcase_04 | AC | 2 ms
6,816 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 32 ms
6,944 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 13 ms
6,820 KB |
testcase_15 | WA | - |
testcase_16 | AC | 3 ms
6,824 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 25 ms
6,940 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 25 ms
6,944 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 37 ms
6,944 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 20 ms
6,944 KB |
testcase_35 | AC | 20 ms
6,820 KB |
testcase_36 | AC | 3 ms
6,820 KB |
testcase_37 | AC | 16 ms
6,820 KB |
testcase_38 | AC | 19 ms
6,816 KB |
testcase_39 | AC | 18 ms
6,820 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); }