結果

問題 No.1745 Selfish Spies 2 (à la Princess' Perfectionism)
ユーザー cureskolcureskol
提出日時 2021-11-14 22:00:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,183 bytes
コンパイル時間 4,933 ms
コンパイル使用メモリ 265,476 KB
実行使用メモリ 46,180 KB
最終ジャッジ日時 2024-05-07 14:09:50
合計ジャッジ時間 10,653 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
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 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:27:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   27 |     auto [from,to,cap,flow]=edges[i];
      |          ^
main.cpp:34:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   34 |     auto [from,to,cap,flow]=edges[l+i];
      |          ^
main.cpp:39:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   39 |     auto [from,to,cap,flow]=edges[l+n+j];
      |          ^
main.cpp:45:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   45 |     auto [from,to,cap,flow]=edges[i];
      |          ^

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n-1);i>=0;i--)
#define ALL(v) v.begin(),v.end()

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,m,l;cin>>n>>m>>l;
  mf_graph<int> fl(n+m+2);
  int S=n+m,T=n+m+1;
  REP(_,l){
    int s,t;cin>>s>>t;s--;t--;
    fl.add_edge(s,n+t,1);
  }
  REP(i,n)fl.add_edge(S,i,1);
  REP(j,m)fl.add_edge(n+j,T,1);
  fl.flow(S,T);
  scc_graph g(n+m);
  auto edges=fl.edges();
  REP(i,l){
    auto [from,to,cap,flow]=edges[i];
    if(flow)g.add_edge(from,to);
    else g.add_edge(to,from);
  }
  auto A=g.scc();
  dsu uf(n+m),uf2(n+m+2);
  REP(i,n){
    auto [from,to,cap,flow]=edges[l+i];
    if(flow)uf2.merge(n+m,to);
    else uf2.merge(n+m+1,to);
  }
  REP(j,m){
    auto [from,to,cap,flow]=edges[l+n+j];
    if(flow)uf2.merge(n+m,from);
    else uf2.merge(n+m+1,from);
  }
  for(auto v:A)for(int p:v)uf.merge(v[0],p);
  REP(i,l){
    auto [from,to,cap,flow]=edges[i];
    if(flow||uf.same(from,to)||uf2.same(from,n+m)||uf2.same(to,n+m))cout<<"Yes\n";
    else cout<<"No\n";
  }
}
0