結果

問題 No.2713 Just Solitaire
ユーザー kotatsugame
提出日時 2024-03-31 14:21:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-30 19:23:37
合計ジャッジ時間 1,814 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/maxflow>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N,M;
	cin>>N>>M;
	atcoder::mf_graph<long>G(N+M+2);
	int S=N+M,T=N+M+1;
	long base=0;
	for(int i=0;i<N;i++)
	{
		int A;cin>>A;
		G.add_edge(S,i,A);
	}
	for(int i=0;i<M;i++)
	{
		int B;cin>>B;
		base+=B;
		G.add_edge(N+i,T,B);
	}
	for(int i=0;i<M;i++)
	{
		int K;cin>>K;
		for(;K--;)
		{
			int C;cin>>C;
			G.add_edge(C-1,N+i,(long)1e18);
		}
	}
	cout<<base-G.flow(S,T)<<endl;
}
0