結果

問題 No.1744 Selfish Spies 1 (à la Princess' Perfectionism)
ユーザー chocoruskchocorusk
提出日時 2021-11-16 04:06:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,551 bytes
コンパイル時間 3,572 ms
コンパイル使用メモリ 194,344 KB
実行使用メモリ 18,236 KB
最終ジャッジ日時 2023-08-22 00:07:07
合計ジャッジ時間 14,324 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
18,236 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 10 ms
4,380 KB
testcase_13 AC 13 ms
4,376 KB
testcase_14 AC 58 ms
4,380 KB
testcase_15 AC 58 ms
4,380 KB
testcase_16 AC 74 ms
4,376 KB
testcase_17 AC 321 ms
4,380 KB
testcase_18 AC 308 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 8 ms
4,376 KB
testcase_22 AC 10 ms
4,376 KB
testcase_23 AC 12 ms
4,380 KB
testcase_24 AC 543 ms
5,284 KB
testcase_25 AC 74 ms
4,384 KB
testcase_26 AC 84 ms
4,380 KB
testcase_27 AC 613 ms
4,380 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0