Submission #34897775


Source Code Expand

#include <bits/stdc++.h>
#include <atcoder/maxflow>
using namespace std;
typedef long long ll;
#define rep(i,a,n) for (ll i=a;i<(ll)n;i++)
ll read(){ll r;scanf("%lld",&r);return r;}

ll INF = 0x3f3f3f3f3f3f3f3f;
int main(){
  int n = read();
  int m = read();
  auto g = atcoder::mf_graph<ll>(n*2);
  rep(i,0,m){ // edge id = [0..2*m-1]
    int u = read()-1;
    int v = read()-1;
    g.add_edge(u*2+1,v*2,INF);
    g.add_edge(v*2+1,u*2,INF);
  }
  // edge id = 2*m + i = [2*m..2*m+n-1]
  rep(i,0,n) g.add_edge(i*2,i*2+1,read());
  int S = 0*2+1;
  int T = (n-1)*2;
  ll c = g.flow(S,T);
  printf("%lld\n",c);
  auto cut = g.min_cut(S);
  vector<int> ans;
  rep(i,1,n-1) if(cut[i*2] && !cut[i*2+1]) ans.push_back(i+1);
  printf("%d\n",(int)ans.size());
  for(auto u:ans) printf("%d ",u);
  return 0;
}

Submission Info

Submission Time
Task G - Builder Takahashi
User cromarmot
Language C++ (GCC 9.2.1)
Score 600
Code Size 803 Byte
Status AC
Exec Time 12 ms
Memory 4172 KiB

Compile Error

./Main.cpp: In function ‘ll read()’:
./Main.cpp:6:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    6 | ll read(){ll r;scanf("%lld",&r);return r;}
      |                ~~~~~^~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 75
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 01_small_08.txt, 01_small_09.txt, 01_small_10.txt, 01_small_11.txt, 01_small_12.txt, 01_small_13.txt, 01_small_14.txt, 01_small_15.txt, 01_small_16.txt, 01_small_17.txt, 01_small_18.txt, 01_small_19.txt, 01_small_20.txt, 02_perfect_00.txt, 02_perfect_01.txt, 03_path_00.txt, 03_path_01.txt, 04_tree_00.txt, 04_tree_01.txt, 05_random_00.txt, 05_random_01.txt, 05_random_02.txt, 05_random_03.txt, 05_random_04.txt, 05_random_05.txt, 05_random_06.txt, 05_random_07.txt, 05_random_08.txt, 05_random_09.txt, 05_random_10.txt, 05_random_11.txt, 05_random_12.txt, 05_random_13.txt, 05_random_14.txt, 06_random_2_00.txt, 06_random_2_01.txt, 06_random_2_02.txt, 06_random_2_03.txt, 06_random_2_04.txt, 06_random_2_05.txt, 06_random_2_06.txt, 06_random_2_07.txt, 06_random_2_08.txt, 06_random_2_09.txt, 06_random_2_10.txt, 06_random_2_11.txt, 06_random_2_12.txt, 06_random_2_13.txt, 06_random_2_14.txt, 06_random_2_15.txt, 06_random_2_16.txt, 06_random_2_17.txt, 06_random_2_18.txt, 06_random_2_19.txt, 07_block_00.txt, 07_block_01.txt, 07_block_02.txt, 07_block_03.txt, 07_block_04.txt, 07_block_05.txt, 07_block_06.txt, 07_block_07.txt, 07_block_08.txt, 07_block_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 8 ms 3648 KiB
00_sample_01.txt AC 2 ms 3648 KiB
00_sample_02.txt AC 2 ms 3560 KiB
01_small_00.txt AC 2 ms 3596 KiB
01_small_01.txt AC 2 ms 3732 KiB
01_small_02.txt AC 2 ms 3764 KiB
01_small_03.txt AC 2 ms 3592 KiB
01_small_04.txt AC 2 ms 3660 KiB
01_small_05.txt AC 2 ms 3768 KiB
01_small_06.txt AC 2 ms 3692 KiB
01_small_07.txt AC 2 ms 3736 KiB
01_small_08.txt AC 2 ms 3692 KiB
01_small_09.txt AC 2 ms 3644 KiB
01_small_10.txt AC 2 ms 3744 KiB
01_small_11.txt AC 2 ms 3772 KiB
01_small_12.txt AC 2 ms 3660 KiB
01_small_13.txt AC 3 ms 3776 KiB
01_small_14.txt AC 2 ms 3652 KiB
01_small_15.txt AC 2 ms 3656 KiB
01_small_16.txt AC 2 ms 3660 KiB
01_small_17.txt AC 2 ms 3716 KiB
01_small_18.txt AC 2 ms 3652 KiB
01_small_19.txt AC 2 ms 3608 KiB
01_small_20.txt AC 2 ms 3736 KiB
02_perfect_00.txt AC 5 ms 4172 KiB
02_perfect_01.txt AC 6 ms 4092 KiB
03_path_00.txt AC 6 ms 3740 KiB
03_path_01.txt AC 3 ms 3764 KiB
04_tree_00.txt AC 2 ms 3592 KiB
04_tree_01.txt AC 4 ms 3760 KiB
05_random_00.txt AC 4 ms 4000 KiB
05_random_01.txt AC 4 ms 4012 KiB
05_random_02.txt AC 4 ms 3980 KiB
05_random_03.txt AC 4 ms 3992 KiB
05_random_04.txt AC 4 ms 4044 KiB
05_random_05.txt AC 3 ms 3944 KiB
05_random_06.txt AC 3 ms 3892 KiB
05_random_07.txt AC 5 ms 3952 KiB
05_random_08.txt AC 4 ms 3952 KiB
05_random_09.txt AC 4 ms 3948 KiB
05_random_10.txt AC 3 ms 3980 KiB
05_random_11.txt AC 5 ms 3944 KiB
05_random_12.txt AC 4 ms 4028 KiB
05_random_13.txt AC 3 ms 3996 KiB
05_random_14.txt AC 5 ms 4016 KiB
06_random_2_00.txt AC 2 ms 3760 KiB
06_random_2_01.txt AC 2 ms 3660 KiB
06_random_2_02.txt AC 12 ms 3788 KiB
06_random_2_03.txt AC 9 ms 3760 KiB
06_random_2_04.txt AC 2 ms 3664 KiB
06_random_2_05.txt AC 2 ms 3756 KiB
06_random_2_06.txt AC 2 ms 3732 KiB
06_random_2_07.txt AC 4 ms 3680 KiB
06_random_2_08.txt AC 2 ms 3660 KiB
06_random_2_09.txt AC 2 ms 3676 KiB
06_random_2_10.txt AC 2 ms 3620 KiB
06_random_2_11.txt AC 2 ms 3760 KiB
06_random_2_12.txt AC 2 ms 3728 KiB
06_random_2_13.txt AC 2 ms 3748 KiB
06_random_2_14.txt AC 2 ms 3624 KiB
06_random_2_15.txt AC 3 ms 3756 KiB
06_random_2_16.txt AC 2 ms 3748 KiB
06_random_2_17.txt AC 2 ms 3748 KiB
06_random_2_18.txt AC 2 ms 3680 KiB
06_random_2_19.txt AC 2 ms 3676 KiB
07_block_00.txt AC 2 ms 3828 KiB
07_block_01.txt AC 3 ms 3820 KiB
07_block_02.txt AC 3 ms 3864 KiB
07_block_03.txt AC 2 ms 3844 KiB
07_block_04.txt AC 4 ms 3840 KiB
07_block_05.txt AC 2 ms 3848 KiB
07_block_06.txt AC 2 ms 3748 KiB
07_block_07.txt AC 2 ms 3852 KiB
07_block_08.txt AC 2 ms 3856 KiB
07_block_09.txt AC 3 ms 3784 KiB