結果

問題 No.1744 Selfish Spies 1 (à la Princess' Perfectionism)
ユーザー 沙耶花沙耶花
提出日時 2021-11-14 21:33:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,041 bytes
コンパイル時間 5,095 ms
コンパイル使用メモリ 275,864 KB
実行使用メモリ 12,068 KB
最終ジャッジ日時 2023-08-20 06:11:28
合計ジャッジ時間 13,228 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 6 ms
4,376 KB
testcase_14 AC 14 ms
4,380 KB
testcase_15 AC 19 ms
4,376 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 58 ms
4,380 KB
testcase_19 RE -
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 4 ms
4,384 KB
testcase_22 RE -
testcase_23 AC 5 ms
4,380 KB
testcase_24 AC 78 ms
5,012 KB
testcase_25 AC 23 ms
4,376 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 583 ms
12,068 KB
testcase_29 AC 65 ms
4,380 KB
testcase_30 AC 65 ms
4,380 KB
testcase_31 AC 63 ms
4,380 KB
testcase_32 AC 63 ms
4,376 KB
testcase_33 AC 632 ms
11,992 KB
testcase_34 AC 618 ms
12,068 KB
testcase_35 AC 632 ms
11,940 KB
testcase_36 AC 688 ms
11,972 KB
testcase_37 AC 651 ms
11,940 KB
testcase_38 AC 639 ms
11,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main(){

	int N,M,L;
	cin>>N>>M>>L;
	
	mf_graph<int> G(2+N+M);
	int S = N+M,T = N+M+1;
	
	vector<int> s(L),t(L);
	vector<int> ind(L);
	rep(i,L){
		cin>>s[i]>>t[i];
		s[i]--;t[i]--;
		ind[i] = G.add_edge(s[i],N+t[i],1);
	}
	vector<int> inds(N),indt(M);
	rep(i,N)indt[i] = G.add_edge(S,i,1);
	rep(i,M)indt[i] = G.add_edge(N+i,T,1);
	
	vector<bool> f(L,false);
	int ans = G.flow(S,T);
	vector<int> p;
	rep(i,L){
		if(G.get_edge(ind[i]).flow==0)f[i] = true;
		else p.push_back(i);
	}
	
	
	rep(i,p.size()){
		int cur = ans;
		int ii = p[i];
		auto GG = G;
		G.change_edge(ind[ii],0,0);
		cur--;
		if(G.flow(s[ii],N+t[ii],1)){
			cur++;
		}
		else{
			G.change_edge(inds[s[ii]],1,0);
			G.change_edge(indt[t[ii]],1,0);
		}
		
		if(cur==ans)f[ii] = true;
		G = GG;
	}
	rep(i,L){
		cout<<(f[i]?"Yes":"No")<<endl;
	}
	
	return 0;
}
0