結果

問題 No.1678 Coin Trade (Multiple)
ユーザー chocoruskchocorusk
提出日時 2021-08-01 22:47:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 319 ms / 5,000 ms
コード長 487 bytes
コンパイル時間 3,477 ms
コンパイル使用メモリ 159,448 KB
実行使用メモリ 18,288 KB
最終ジャッジ日時 2023-09-02 15:00:32
合計ジャッジ時間 10,748 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 61 ms
12,276 KB
testcase_04 AC 180 ms
15,724 KB
testcase_05 AC 113 ms
17,584 KB
testcase_06 AC 96 ms
17,560 KB
testcase_07 AC 151 ms
13,320 KB
testcase_08 AC 116 ms
13,932 KB
testcase_09 AC 119 ms
17,940 KB
testcase_10 AC 51 ms
9,244 KB
testcase_11 AC 136 ms
15,648 KB
testcase_12 AC 46 ms
9,500 KB
testcase_13 AC 247 ms
17,208 KB
testcase_14 AC 95 ms
12,212 KB
testcase_15 AC 116 ms
15,048 KB
testcase_16 AC 66 ms
14,936 KB
testcase_17 AC 119 ms
17,924 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,384 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,384 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 1 ms
4,384 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,380 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 315 ms
17,992 KB
testcase_49 AC 319 ms
18,184 KB
testcase_50 AC 312 ms
18,140 KB
testcase_51 AC 309 ms
18,144 KB
testcase_52 AC 317 ms
17,992 KB
testcase_53 AC 306 ms
18,088 KB
testcase_54 AC 306 ms
18,032 KB
testcase_55 AC 301 ms
18,072 KB
testcase_56 AC 303 ms
18,096 KB
testcase_57 AC 304 ms
18,288 KB
testcase_58 AC 155 ms
14,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
int main()
{
	int n, k;
	cin>>n>>k;
	mcf_graph<int, ll> g(n);
	ll a[50050];
    const ll geta=1e9;
	for(int i=0; i<n; i++){
		cin>>a[i];
		int m; cin>>m;
		for(int j=0; j<m; j++){
			int b; cin>>b; b--;
			g.add_edge(b, i, 1, a[b]-a[i]+geta*(i-b));
		}
	}
	for(int i=0; i<n-1; i++) g.add_edge(i, i+1, k, geta);
	cout<<geta*(n-1)*k-g.flow(0, n-1, k).second<<endl;
    return 0;
}
0