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