結果

問題 No.1744 Selfish Spies 1 (à la Princess' Perfectionism)
ユーザー umezoumezo
提出日時 2021-11-15 02:55:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 964 bytes
コンパイル時間 4,333 ms
コンパイル使用メモリ 282,008 KB
実行使用メモリ 30,936 KB
最終ジャッジ日時 2024-05-07 19:44:47
合計ジャッジ時間 8,222 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 RE -
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
6,944 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 3 ms
6,944 KB
testcase_21 AC 3 ms
6,940 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 46 ms
9,580 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 233 ms
30,872 KB
testcase_29 AC 37 ms
19,516 KB
testcase_30 AC 37 ms
19,524 KB
testcase_31 AC 38 ms
19,476 KB
testcase_32 AC 42 ms
19,540 KB
testcase_33 AC 221 ms
30,920 KB
testcase_34 AC 225 ms
30,936 KB
testcase_35 AC 226 ms
30,812 KB
testcase_36 AC 225 ms
30,840 KB
testcase_37 AC 231 ms
30,716 KB
testcase_38 AC 233 ms
30,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n,m,l;
  cin>>n>>m>>l;
  vector<int> S(l),T(l);
  rep(i,l) cin>>S[i]>>T[i];
  
  mf_graph<int> g(n+m+2);
  rep(i,l) g.add_edge(S[i],n+T[i],1);
  for(int i=1;i<=n;i++) g.add_edge(0,i,1);
  for(int i=n+1;i<=n+m;i++) g.add_edge(i,n+m+1,1);
  g.flow(0,n+m+1);
  auto A=g.edges();
  
  scc_graph g1(n*m+1);
  rep(i,l){
    g1.add_edge(S[i],T[i]+n);
    if(A[i].flow>0) g1.add_edge(T[i]+n,S[i]);
  }
  auto B=g1.scc();
  
  map<pair<int,int>,int> M;
  for(int i=0;i<B.size();i++){
    if(B[i].size()==2){
      int a=B[i][0],b=B[i][1];
      if(a>b) swap(a,b);
      M[{a,b-n}]=1;
    }
  }
     
  rep(i,l){
    if(M[{S[i],T[i]}]) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }

  return 0;
}
0