結果
問題 | No.1244 Black Segment |
ユーザー | fgwiebfaoish |
提出日時 | 2021-03-19 20:32:06 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 256 ms / 2,000 ms |
コード長 | 2,831 bytes |
コンパイル時間 | 4,682 ms |
コンパイル使用メモリ | 107,536 KB |
実行使用メモリ | 39,520 KB |
最終ジャッジ日時 | 2023-08-11 23:56:29 |
合計ジャッジ時間 | 14,441 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 59 ms
20,904 KB |
testcase_01 | AC | 62 ms
20,900 KB |
testcase_02 | AC | 59 ms
22,748 KB |
testcase_03 | AC | 58 ms
20,728 KB |
testcase_04 | AC | 60 ms
20,816 KB |
testcase_05 | AC | 59 ms
20,864 KB |
testcase_06 | AC | 62 ms
20,908 KB |
testcase_07 | AC | 58 ms
18,680 KB |
testcase_08 | AC | 62 ms
20,912 KB |
testcase_09 | AC | 62 ms
22,756 KB |
testcase_10 | AC | 61 ms
20,896 KB |
testcase_11 | AC | 62 ms
20,788 KB |
testcase_12 | AC | 59 ms
20,768 KB |
testcase_13 | AC | 65 ms
21,052 KB |
testcase_14 | AC | 162 ms
30,160 KB |
testcase_15 | AC | 65 ms
23,128 KB |
testcase_16 | AC | 163 ms
28,296 KB |
testcase_17 | AC | 68 ms
23,092 KB |
testcase_18 | AC | 166 ms
31,200 KB |
testcase_19 | AC | 213 ms
36,360 KB |
testcase_20 | AC | 235 ms
35,100 KB |
testcase_21 | AC | 227 ms
35,292 KB |
testcase_22 | AC | 238 ms
34,884 KB |
testcase_23 | AC | 236 ms
34,936 KB |
testcase_24 | AC | 242 ms
39,520 KB |
testcase_25 | AC | 237 ms
37,584 KB |
testcase_26 | AC | 227 ms
35,080 KB |
testcase_27 | AC | 235 ms
35,624 KB |
testcase_28 | AC | 252 ms
37,652 KB |
testcase_29 | AC | 245 ms
37,488 KB |
testcase_30 | AC | 242 ms
35,460 KB |
testcase_31 | AC | 248 ms
37,768 KB |
testcase_32 | AC | 256 ms
35,960 KB |
testcase_33 | AC | 254 ms
37,728 KB |
testcase_34 | AC | 237 ms
35,632 KB |
testcase_35 | AC | 230 ms
34,772 KB |
testcase_36 | AC | 234 ms
36,684 KB |
testcase_37 | AC | 240 ms
36,700 KB |
testcase_38 | AC | 233 ms
38,216 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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>[] li; static bool[] b; static void Main(){ Sc sc=new Sc(); var s=sc.Ia; int n=s[0]+1,m=s[1]; li=new List<int>[n+1]; b=new bool[n+1]; for(int i=1;i<=n;i++){li[i]=new List<int>();} for(int i=0;i<m;i++){ var e=sc.Ia; li[e[0]].Add(e[1]+1); li[e[1]+1].Add(e[0]); } var qu=new Queue<ValueTuple<int,int>>(); for(int i = 1;i<=s[2];i++) {qu.Enqueue(ValueTuple.Create(i,0));} while(qu.Count>0){ var e=qu.Dequeue(); if(e.Item1>s[3]){ Console.WriteLine(e.Item2); return; } if(b[e.Item1]){continue;} b[e.Item1]=true; for(int j = 0;j<li[e.Item1].Count;j++) { if(!b[li[e.Item1][j]]){qu.Enqueue(ValueTuple.Create(li[e.Item1][j],e.Item2+1));} } } Console.WriteLine("{0}",-1); } } 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;} }