結果

問題 No.200 カードファイト!
ユーザー 沙耶花
提出日時 2021-11-04 08:04:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 719 bytes
コンパイル時間 4,942 ms
コンパイル使用メモリ 257,648 KB
最終ジャッジ日時 2025-01-25 11:23:32
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000000000
	

int main(){	
	
	int N;
	cin>>N;
	
	int A;
	cin>>A;
	
	vector<int> a(A);
	rep(i,A)cin>>a[i];
	int C;
	cin>>C;
	vector<int> c(C);
	rep(i,C)cin>>c[i];
	
	mf_graph<int> G(A+C+2+2);
	int S = A+C+2,T = A+C+3;
	
	rep(i,A){
		G.add_edge(S,i,N/A);
		G.add_edge(A+C, i, 1);
	}
	rep(i,C){
		G.add_edge(A+i,T,N/C);
		G.add_edge(A+i,A+C+1,1);
	}
	G.add_edge(S,A+C,N%A);
	G.add_edge(A+C+1,T,N%C);
	rep(i,A){
		rep(j,C){
			if(a[i]>c[j])G.add_edge(i,A+j,100);
		}
	}
	
	cout<<G.flow(S,T)<<endl;
	
	return 0;
	
}
0