結果

問題 No.90 品物の並び替え
コンテスト
ユーザー kotatsugame
提出日時 2017-08-11 05:09:47
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 311 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 101 ms
コンパイル使用メモリ 29,768 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-08 16:13:25
合計ジャッジ時間 689 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    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:15: warning: data definition has no type or storage class
    1 | n,m;a[9],b[9];k;
      |               ^
main.c:2:1: warning: data definition has no type or storage class
    2 | t[2][99],s[99];
      | ^
main.c: In function ‘main’:
main.c:17:13: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   17 |         for(scanf("%d%d",&n,&m);~scanf("%d%d%d",t[0]+k,t[1]+k,s+k);)k++;
      |             ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | n,m;a[9],b[9];k;
main.c:18:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   18 |         printf("%d",f(0));
      |         ^~~~~~
main.c:18:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #
raw source code

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