結果

問題 No.1744 Selfish Spies 1 (à la Princess' Perfectionism)
ユーザー chocoruskchocorusk
提出日時 2021-11-16 04:15:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 599 ms / 5,000 ms
コード長 1,480 bytes
コンパイル時間 3,431 ms
コンパイル使用メモリ 194,532 KB
実行使用メモリ 9,200 KB
最終ジャッジ日時 2023-08-22 00:20:29
合計ジャッジ時間 9,232 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 5 ms
4,380 KB
testcase_14 AC 8 ms
4,500 KB
testcase_15 AC 13 ms
4,376 KB
testcase_16 AC 23 ms
4,376 KB
testcase_17 AC 47 ms
4,384 KB
testcase_18 AC 35 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 4 ms
4,380 KB
testcase_23 AC 5 ms
4,380 KB
testcase_24 AC 57 ms
4,576 KB
testcase_25 AC 24 ms
4,380 KB
testcase_26 AC 28 ms
4,376 KB
testcase_27 AC 51 ms
4,376 KB
testcase_28 AC 462 ms
9,048 KB
testcase_29 AC 56 ms
4,376 KB
testcase_30 AC 53 ms
4,380 KB
testcase_31 AC 53 ms
4,380 KB
testcase_32 AC 53 ms
4,376 KB
testcase_33 AC 553 ms
9,052 KB
testcase_34 AC 562 ms
9,044 KB
testcase_35 AC 337 ms
9,052 KB
testcase_36 AC 420 ms
8,996 KB
testcase_37 AC 562 ms
9,072 KB
testcase_38 AC 599 ms
9,200 KB
権限があれば一括ダウンロードができます

ソースコード

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;
        }
        g.change_edge(i, 0, 0);
        if(g.flow(a[i], b[i]+n)){
            ans[i]=1;
            g.change_edge(i, 1, 0);
        }else{
            g.change_edge(i, 1, 0);
            g.flow(a[i], b[i]+n);
        }
    }
    for(int i=0; i<l; i++){
        printf(ans[i] ? "Yes\n" : "No\n");
    }
    return 0;
}
0