結果

問題 No.1324 Approximate the Matrix
ユーザー tailstails
提出日時 2020-12-21 09:43:28
言語 cLay
(20240104-1)
結果
TLE  
実行時間 -
コード長 625 bytes
コンパイル時間 3,340 ms
コンパイル使用メモリ 179,964 KB
実行使用メモリ 393,304 KB
最終ジャッジ日時 2023-09-19 01:58:29
合計ジャッジ時間 6,689 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,940 KB
testcase_01 AC 2 ms
5,444 KB
testcase_02 AC 2 ms
5,596 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

int n,k,a[200],b[200];
int p[200][200],q[200][200];

int nn_s,nn_t,nn_a[200],nn_b[200],nn_p[200][200];

minCostFlow<int,int> f;
{
	rd(n,k,a(n),b(n),p(n,n));
	f.malloc(n*n+n+n+2);
	f.init(n*n+n+n+2);
	
	int nn=0;
	nn_s=nn++;
	nn_t=nn++;
	rep(i,n) nn_a[i]=nn++;
	rep(j,n) nn_b[j]=nn++;
	rep(i,n) rep(j,n) nn_p[i][j]=nn++;

	rep(i,n) f.addEdge(nn_s,nn_a[i],a[i],0);
	rep(i,n) rep(j,n) rep(m,200) f.addEdge(nn_a[i],nn_p[i][j],1,(m-p[i][j])*2+1);
	rep(i,n) rep(j,n) f.addEdge(nn_p[i][j],nn_b[j],200,0);
	rep(j,n) f.addEdge(nn_b[j],nn_t,b[j],0);
	int fres,z;
	f.solve(nn_s,nn_t,fres,z);
	rep(i,n) rep(j,n) z+=p[i][j]**2;
	wt(z);
}
0