結果

問題 No.1254 補強への架け橋
ユーザー fgwiebfaoishfgwiebfaoish
提出日時 2020-10-09 23:43:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 2,993 bytes
コンパイル時間 2,096 ms
コンパイル使用メモリ 109,592 KB
実行使用メモリ 58,024 KB
最終ジャッジ日時 2023-09-27 20:03:31
合計ジャッジ時間 21,755 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,860 KB
testcase_01 AC 58 ms
22,832 KB
testcase_02 AC 62 ms
20,852 KB
testcase_03 AC 60 ms
20,788 KB
testcase_04 AC 59 ms
20,784 KB
testcase_05 AC 57 ms
22,848 KB
testcase_06 AC 58 ms
20,876 KB
testcase_07 AC 58 ms
20,808 KB
testcase_08 AC 59 ms
20,848 KB
testcase_09 AC 59 ms
22,992 KB
testcase_10 AC 60 ms
20,844 KB
testcase_11 AC 58 ms
22,828 KB
testcase_12 AC 57 ms
20,860 KB
testcase_13 AC 59 ms
20,904 KB
testcase_14 AC 60 ms
20,916 KB
testcase_15 AC 60 ms
20,748 KB
testcase_16 AC 58 ms
20,860 KB
testcase_17 AC 58 ms
20,884 KB
testcase_18 AC 60 ms
20,792 KB
testcase_19 AC 59 ms
20,800 KB
testcase_20 AC 58 ms
20,864 KB
testcase_21 AC 57 ms
20,884 KB
testcase_22 AC 59 ms
18,864 KB
testcase_23 AC 59 ms
20,812 KB
testcase_24 AC 59 ms
22,880 KB
testcase_25 AC 60 ms
22,840 KB
testcase_26 AC 58 ms
22,860 KB
testcase_27 AC 57 ms
20,924 KB
testcase_28 AC 60 ms
20,780 KB
testcase_29 AC 65 ms
22,872 KB
testcase_30 AC 61 ms
20,796 KB
testcase_31 AC 59 ms
20,812 KB
testcase_32 AC 60 ms
22,856 KB
testcase_33 AC 62 ms
20,800 KB
testcase_34 AC 59 ms
20,732 KB
testcase_35 AC 61 ms
20,792 KB
testcase_36 AC 62 ms
20,860 KB
testcase_37 AC 61 ms
22,840 KB
testcase_38 AC 60 ms
20,796 KB
testcase_39 AC 61 ms
20,884 KB
testcase_40 AC 61 ms
18,748 KB
testcase_41 AC 62 ms
18,856 KB
testcase_42 AC 59 ms
20,788 KB
testcase_43 AC 59 ms
22,964 KB
testcase_44 AC 61 ms
18,924 KB
testcase_45 AC 59 ms
20,844 KB
testcase_46 AC 58 ms
20,868 KB
testcase_47 AC 59 ms
20,928 KB
testcase_48 AC 60 ms
20,924 KB
testcase_49 AC 62 ms
20,880 KB
testcase_50 AC 60 ms
20,804 KB
testcase_51 AC 57 ms
20,964 KB
testcase_52 AC 58 ms
18,996 KB
testcase_53 AC 58 ms
20,908 KB
testcase_54 AC 62 ms
20,932 KB
testcase_55 AC 60 ms
22,908 KB
testcase_56 AC 61 ms
22,812 KB
testcase_57 AC 60 ms
20,932 KB
testcase_58 AC 61 ms
22,912 KB
testcase_59 AC 59 ms
21,004 KB
testcase_60 AC 57 ms
20,912 KB
testcase_61 AC 59 ms
20,920 KB
testcase_62 AC 60 ms
22,952 KB
testcase_63 AC 75 ms
28,344 KB
testcase_64 AC 63 ms
19,168 KB
testcase_65 AC 70 ms
23,872 KB
testcase_66 AC 65 ms
25,560 KB
testcase_67 AC 64 ms
21,148 KB
testcase_68 AC 65 ms
25,772 KB
testcase_69 AC 70 ms
23,860 KB
testcase_70 AC 70 ms
23,012 KB
testcase_71 AC 64 ms
21,292 KB
testcase_72 AC 70 ms
23,880 KB
testcase_73 AC 63 ms
21,056 KB
testcase_74 AC 70 ms
23,880 KB
testcase_75 AC 67 ms
23,340 KB
testcase_76 AC 60 ms
21,108 KB
testcase_77 AC 65 ms
21,468 KB
testcase_78 AC 69 ms
23,848 KB
testcase_79 AC 73 ms
26,344 KB
testcase_80 AC 70 ms
23,984 KB
testcase_81 AC 73 ms
22,336 KB
testcase_82 AC 71 ms
26,000 KB
testcase_83 AC 234 ms
37,972 KB
testcase_84 AC 228 ms
37,632 KB
testcase_85 AC 158 ms
32,756 KB
testcase_86 AC 199 ms
37,928 KB
testcase_87 AC 200 ms
36,912 KB
testcase_88 AC 80 ms
28,796 KB
testcase_89 AC 227 ms
39,924 KB
testcase_90 AC 157 ms
31,224 KB
testcase_91 AC 131 ms
31,620 KB
testcase_92 AC 97 ms
28,544 KB
testcase_93 AC 183 ms
39,516 KB
testcase_94 AC 177 ms
34,188 KB
testcase_95 AC 171 ms
36,244 KB
testcase_96 AC 205 ms
37,296 KB
testcase_97 AC 124 ms
30,604 KB
testcase_98 AC 208 ms
39,360 KB
testcase_99 AC 152 ms
34,420 KB
testcase_100 AC 229 ms
40,200 KB
testcase_101 AC 92 ms
28,332 KB
testcase_102 AC 76 ms
28,608 KB
testcase_103 AC 95 ms
28,528 KB
testcase_104 AC 112 ms
30,012 KB
testcase_105 AC 205 ms
33,280 KB
testcase_106 AC 130 ms
33,220 KB
testcase_107 AC 219 ms
40,020 KB
testcase_108 AC 231 ms
37,636 KB
testcase_109 AC 187 ms
35,136 KB
testcase_110 AC 162 ms
36,168 KB
testcase_111 AC 190 ms
36,864 KB
testcase_112 AC 105 ms
29,768 KB
testcase_113 AC 165 ms
33,964 KB
testcase_114 AC 127 ms
30,948 KB
testcase_115 AC 79 ms
29,164 KB
testcase_116 AC 132 ms
31,864 KB
testcase_117 AC 112 ms
29,584 KB
testcase_118 AC 227 ms
37,152 KB
testcase_119 AC 152 ms
32,328 KB
testcase_120 AC 219 ms
38,776 KB
testcase_121 AC 103 ms
31,028 KB
testcase_122 AC 135 ms
31,700 KB
testcase_123 AC 57 ms
20,796 KB
testcase_124 AC 290 ms
57,968 KB
testcase_125 AC 261 ms
58,024 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Threading;
using System.Runtime.CompilerServices;
static class Program{
	const int mod=(int)1e9+7;
	static List<(int,int)>[] li;
	static bool[] b,h;
	static int[] low,ord;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		int n=s[0],m=n;
		li=new List<(int,int)>[n+1];
		b=new bool[n+1];
		h=new bool[n+1];
		low=new int[n+1];
		ord=new int[n+1];
		for(int i=1;i<=n;i++){li[i]=new List<(int,int)>();}
		for(int i=0;i<m;i++){
			var e=sc.Ia;
			li[e[0]].Add((e[1],i+1));
			li[e[1]].Add((e[0],i+1));
		}

		Fu(1,0,-1);

		var ans=new List<int>();
		for(int i=1;i<=n;i++){
			if(!h[i]){
				ans.Add(i);
			}
		}
		Console.WriteLine(ans.Count);
		Console.WriteLine("{0}",string.Join(" ",ans));
	}
	static void Fu(int a,int g,int p){
		b[a]=true;
		ord[a]=low[a]=g;
		for(int i=0;i<li[a].Count;i++){
			if(!b[li[a][i].Item1]){
				Fu(li[a][i].Item1,g+1,a);
				if(low[li[a][i].Item1]==ord[li[a][i].Item1]){h[li[a][i].Item2]=true;}
			}
			if(li[a][i].Item1!=p){low[a]=Min(low[li[a][i].Item1],low[a]);}
		}
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
0