結果

問題 No.90 品物の並び替え
ユーザー kotatsugamekotatsugame
提出日時 2017-08-11 05:09:47
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 111 ms / 5,000 ms
コード長 311 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 30,336 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 21:45:19
合計ジャッジ時間 1,046 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 9 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 10 ms
5,376 KB
testcase_06 AC 8 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 111 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | n,m;a[9],b[9];k;
      | ^
main.c:1:1: warning: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: warning: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
    1 | n,m;a[9],b[9];k;
      |   ^
main.c:1:5: warning: data definition has no type or storage class
    1 | n,m;a[9],b[9];k;
      |     ^
main.c:1:5: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:10: warning: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    1 | n,m;a[9],b[9];k;
      |          ^
main.c:1:15: warning: data definition has no type or storage class
    1 | n,m;a[9],b[9];k;
      |               ^
main.c:1:15: warning: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
    2 | t[2][99],s[99];
      | ^
main.c:2:1: warning: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:2:10: warning: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
    2 | t[2][99],s[99];
      |          ^
main.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
    3 | f(i){
      | ^
main.c: In function 'f':
main.c:3:1: warning: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:11:55: warning: implicit declaration of function 'fmax' [-Wimplicit-function-declaration]
   11 |                 for(;j<n;j++)b[j]||(b[j]=1,a[i]=j,ans=fmax(ans,f(i+1)),b[j]=0);
      |                                                       ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'fmax'
  +++ |+#include <math.h>
    1 | n,m;a[9],b[9];k;
main.c:11:55: warning: incompatible implicit declaration of built-in function 'fmax' [-Wbuiltin-declaration-mismatch]
   11 |                 for(;j<n;j++)b[j]||(b[j]=1,a[i]=j,ans=fmax(ans,f(i+1)),b[j]=0);
      |                                                       ^~~~
main.c:11:55: note: include '<math.h>

ソースコード

diff #

n,m;a[9],b[9];k;
t[2][99],s[99];
f(i){
	int ans=0,j=0;
	if(i==n)
	{
		for(;j<m;j++)a[t[0][j]]<a[t[1][j]]&&(ans+=s[j]);
	}
	else
	{
		for(;j<n;j++)b[j]||(b[j]=1,a[i]=j,ans=fmax(ans,f(i+1)),b[j]=0);
	}
	return ans;
}
main()
{
	for(scanf("%d%d",&n,&m);~scanf("%d%d%d",t[0]+k,t[1]+k,s+k);)k++;
	printf("%d",f(0));
}
0