結果
問題 |
No.1744 Selfish Spies 1 (à la Princess' Perfectionism)
|
ユーザー |
|
提出日時 | 2021-11-14 22:00:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,159 bytes |
コンパイル時間 | 4,477 ms |
コンパイル使用メモリ | 257,308 KB |
最終ジャッジ日時 | 2025-01-25 18:18:10 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 RE * 6 TLE * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; // ACL using ll = int; #include <atcoder/all> using namespace atcoder; int main() { int N, M, L; cin >> N >> M >> L; vector<pair<ll, ll>> pairs(L); for (int i = 0; i < L; i++) { int S, T; cin >> S >> T; pairs[i] = {S-1, T-1}; } mf_graph<int> g1(N * 2 + 2); int s = N * 2, t = N * 2 + 1; for (int j = 0; j < L; j++) { g1.add_edge(pairs[j].first, pairs[j].second + N, 1); } for (int j = 0; j < N; j++) { g1.add_edge(s, j, 1); g1.add_edge(j + N, t, 1); } int maxflow = g1.flow(s, t); for (int i = 0; i < L; i++) { mf_graph<int> g(N * 2 + 2); int s = N * 2, t = N * 2 + 1; for (int j = 0; j < L; j++) { if (j == i) continue; g.add_edge(pairs[j].first, pairs[j].second + N, 1); } for (int j = 0; j < N; j++) { g.add_edge(s, j, 1); g.add_edge(j + N, t, 1); } int flow = g.flow(s, t); cout << ((flow == maxflow) ? "Yes" : "No") << "\n"; } }