結果
問題 | No.324 落ちてた閉路グラフ |
ユーザー | tails |
提出日時 | 2015-12-17 10:02:43 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 13 ms / 5,000 ms |
コード長 | 458 bytes |
コンパイル時間 | 737 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 19:29:48 |
合計ジャッジ時間 | 1,995 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 34 |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | d[3010][2][2]; | ^ 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 | w[3010]; | ^ main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘w’ [-Wimplicit-int] main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 3 | max(a,b){return a>b?a:b;} | ^~~ main.c: In function ‘max’: main.c:3:1: warning: type of ‘a’ defaults to ‘int’ [-Wimplicit-int] main.c:3:1: warning: type of ‘b’ defaults to ‘int’ [-Wimplicit-int] main.c: At top level: main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 4 | main(i,j,k,n,m){ | ^~~~ main.c: In function ‘main’: main.c:4:1: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘j’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘k’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘m’ defaults to ‘int’ [-Wimplicit-int] main.c:5:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 5 | scanf("%d%d",&n,&m); | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | d[3010][2][2]; main.c:5:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 5 | scanf("%d%d",&n,&m); | ^~~~~ main.c:5:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:12:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 12 | printf("%d",max(max(d[m][0][0],d[m][0][1]),max(d[m][1][0],d[m][1][1]+w[n-1]))); | ^~~~~~ main.c:
ソースコード
d[3010][2][2]; w[3010]; max(a,b){return a>b?a:b;} main(i,j,k,n,m){ scanf("%d%d",&n,&m); for(i=0;i<n;++i)scanf("%d",w+i); for(k=n;k>=0;--k)for(j=0;j<2;++j)d[k][j][0]=d[k][j][1]=-999999; d[0][0][0]=d[1][1][1]=0; for(i=1;i<n;++i)for(k=i+1;k>=0;--k)for(j=0;j<2;++j) d[k][j][0]=max(d[k][j][0],d[k][j][1]), k&&(d[k][j][1]=max(d[k-1][j][0],d[k-1][j][1]+w[i-1])); printf("%d",max(max(d[m][0][0],d[m][0][1]),max(d[m][1][0],d[m][1][1]+w[n-1]))); return 0; }