結果
問題 | No.1744 Selfish Spies 1 (à la Princess' Perfectionism) |
ユーザー |
![]() |
提出日時 | 2021-11-16 04:06:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,551 bytes |
コンパイル時間 | 3,145 ms |
コンパイル使用メモリ | 188,004 KB |
最終ジャッジ日時 | 2025-01-25 18:41:08 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 TLE * 7 |
ソースコード
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #include <fstream> #include <utility> #include <functional> #include <time.h> #include <stack> #include <array> #include <list> #include <atcoder/all> #define popcount __builtin_popcount using namespace std; using namespace atcoder; typedef long long ll; typedef pair<int, int> P; using mint=modint998244353; int main() { int n, m, l; cin>>n>>m>>l; int s=n+m, t=s+1; mf_graph<int> g(n+m+2); int a[100010], b[100010]; for(int i=0; i<l; i++){ cin>>a[i]>>b[i]; a[i]--; b[i]--; g.add_edge(a[i], b[i]+n, 1); } for(int i=0; i<n; i++) g.add_edge(s, i, 1); for(int i=0; i<m; i++) g.add_edge(i+n, t, 1); int f=g.flow(s, t); bool ans[100010]={}; //cout<<f<<endl; for(int i=0; i<l; i++){ if(g.get_edge(i).flow==0){ ans[i]=1; continue; } mf_graph<int> g1(n+m+2); for(int j=0; j<l; j++){ if(i!=j)g1.add_edge(a[j], b[j]+n, 1); } for(int j=0; j<n; j++) g1.add_edge(s, j, 1); for(int j=0; j<m; j++) g1.add_edge(j+n, t, 1); if(g1.flow(s, t)==f) ans[i]=1; } for(int i=0; i<l; i++){ printf(ans[i] ? "Yes" : "No"); printf("\n"); } return 0; }