結果

問題 No.1744 Selfish Spies 1 (à la Princess' Perfectionism)
ユーザー cureskolcureskol
提出日時 2021-11-14 21:37:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 895 bytes
コンパイル時間 5,895 ms
コンパイル使用メモリ 264,064 KB
実行使用メモリ 11,804 KB
最終ジャッジ日時 2024-05-07 13:37:53
合計ジャッジ時間 6,889 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
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 2 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 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 9 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 39 ms
11,740 KB
testcase_29 AC 4 ms
6,944 KB
testcase_30 AC 4 ms
6,940 KB
testcase_31 AC 4 ms
6,944 KB
testcase_32 AC 5 ms
6,940 KB
testcase_33 AC 37 ms
11,684 KB
testcase_34 AC 36 ms
11,720 KB
testcase_35 AC 40 ms
11,568 KB
testcase_36 AC 39 ms
11,560 KB
testcase_37 AC 40 ms
11,668 KB
testcase_38 AC 36 ms
11,804 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:35:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   35 |     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);
  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))cout<<"Yes\n";
    else cout<<"No\n";
  }
}
0