結果

問題 No.1582 Vertexes vs Edges
ユーザー kiyoshi0205kiyoshi0205
提出日時 2021-07-02 22:46:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 3,995 ms
コンパイル使用メモリ 239,232 KB
実行使用メモリ 18,112 KB
最終ジャッジ日時 2023-09-11 23:09:35
合計ジャッジ時間 7,433 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 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 4 ms
4,376 KB
testcase_05 AC 77 ms
15,560 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 12 ms
5,040 KB
testcase_08 AC 38 ms
9,232 KB
testcase_09 AC 73 ms
14,864 KB
testcase_10 AC 45 ms
10,352 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 31 ms
8,288 KB
testcase_13 AC 60 ms
11,504 KB
testcase_14 AC 60 ms
11,552 KB
testcase_15 AC 90 ms
15,144 KB
testcase_16 AC 42 ms
8,860 KB
testcase_17 AC 58 ms
11,276 KB
testcase_18 AC 107 ms
17,348 KB
testcase_19 AC 57 ms
11,436 KB
testcase_20 AC 55 ms
10,944 KB
testcase_21 AC 50 ms
9,892 KB
testcase_22 AC 91 ms
15,536 KB
testcase_23 AC 32 ms
7,460 KB
testcase_24 AC 16 ms
5,588 KB
testcase_25 AC 48 ms
9,664 KB
testcase_26 AC 37 ms
8,608 KB
testcase_27 AC 88 ms
14,736 KB
testcase_28 AC 26 ms
6,780 KB
testcase_29 AC 72 ms
12,620 KB
testcase_30 AC 45 ms
9,540 KB
testcase_31 AC 75 ms
13,332 KB
testcase_32 AC 31 ms
7,600 KB
testcase_33 AC 121 ms
18,096 KB
testcase_34 AC 124 ms
18,112 KB
testcase_35 AC 124 ms
18,096 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:25:11: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   25 |   for(auto[a,b]:v){
      |           ^

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using mint=modint1000000007;
using ll=long long;
#define rep(i,N) for(int i=0;i<N;++i)
ll N,a,b;
int main(){
  cin>>N;
  dsu g(N*2);
  vector<pair<ll,ll>> v;
  rep(i,N-1){
    cin>>a>>b;
    v.emplace_back(--a,--b);
    g.merge(a,b+N);
    g.merge(b,a+N);
  }
  mf_graph<int> fg(N+2);
  rep(i,N)if(g.same(0,i)){
    fg.add_edge(N,i,1);
  }else{
    fg.add_edge(i,N+1,1);
  }
  for(auto[a,b]:v){
    if(g.same(0,a))fg.add_edge(a,b,1);
    else fg.add_edge(b,a,1);
  }
  cout<<fg.flow(N,N+1)<<endl;
}
0