結果

問題 No.812 Change of Class
ユーザー 👑 tatt61880tatt61880
提出日時 2019-04-13 00:25:20
言語 Kuin
(KuinC++ v.2021.9.17)
結果
TLE  
実行時間 -
コード長 1,163 bytes
コンパイル時間 2,651 ms
コンパイル使用メモリ 171,232 KB
実行使用メモリ 22,864 KB
最終ジャッジ日時 2023-10-14 15:46:45
合計ジャッジ時間 16,878 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
22,864 KB
testcase_01 AC 26 ms
5,012 KB
testcase_02 AC 88 ms
7,840 KB
testcase_03 AC 191 ms
12,992 KB
testcase_04 AC 168 ms
11,832 KB
testcase_05 AC 375 ms
13,380 KB
testcase_06 AC 346 ms
11,136 KB
testcase_07 AC 9 ms
7,384 KB
testcase_08 AC 4 ms
5,180 KB
testcase_09 AC 352 ms
14,724 KB
testcase_10 AC 356 ms
14,500 KB
testcase_11 AC 41 ms
13,824 KB
testcase_12 AC 241 ms
14,136 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 232 ms
10,924 KB
testcase_16 AC 15 ms
4,348 KB
testcase_17 AC 219 ms
11,260 KB
testcase_18 AC 157 ms
9,308 KB
testcase_19 AC 186 ms
10,040 KB
testcase_20 AC 362 ms
14,252 KB
testcase_21 AC 146 ms
8,672 KB
testcase_22 AC 66 ms
6,232 KB
testcase_23 AC 12 ms
4,352 KB
testcase_24 AC 19 ms
4,552 KB
testcase_25 AC 54 ms
5,588 KB
testcase_26 AC 301 ms
12,668 KB
testcase_27 AC 250 ms
11,332 KB
testcase_28 AC 174 ms
9,916 KB
testcase_29 AC 39 ms
4,988 KB
testcase_30 AC 238 ms
11,024 KB
testcase_31 AC 189 ms
9,756 KB
testcase_32 AC 84 ms
7,044 KB
testcase_33 AC 250 ms
12,248 KB
testcase_34 AC 18 ms
4,628 KB
testcase_35 AC 46 ms
5,540 KB
testcase_36 AC 18 ms
4,580 KB
testcase_37 AC 109 ms
7,188 KB
testcase_38 AC 16 ms
8,424 KB
testcase_39 AC 110 ms
7,204 KB
testcase_40 AC 27 ms
4,896 KB
testcase_41 AC 12 ms
7,656 KB
testcase_42 AC 240 ms
10,700 KB
testcase_43 AC 63 ms
9,740 KB
testcase_44 AC 158 ms
8,636 KB
testcase_45 AC 18 ms
4,420 KB
testcase_46 AC 59 ms
9,472 KB
testcase_47 AC 157 ms
8,580 KB
testcase_48 AC 176 ms
10,188 KB
testcase_49 AC 46 ms
5,264 KB
testcase_50 AC 3 ms
4,352 KB
testcase_51 AC 50 ms
6,300 KB
testcase_52 AC 105 ms
10,036 KB
testcase_53 AC 30 ms
5,088 KB
testcase_54 AC 26 ms
4,740 KB
testcase_55 TLE -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var ss: [][]char
	do ss :: cui@input().split(" ")
	var N: int :: ss[0].toInt(&)
	var M: int :: ss[1].toInt(&)
	var friends: [][]int :: #[N, 0]int
	for i(0, M - 1)
		do ss :: cui@input().split(" ")
		var p: int :: ss[0].toInt(&) - 1
		var q: int :: ss[1].toInt(&) - 1
		do friends[p] :~ [q]
		do friends[q] :~ [p]
	end for
	var Q: int :: cui@input().toInt(&)
	
	var que: queue<int> :: #queue<int>
	var people: []int :: #[N]int
	for(1, Q)
		for i(0, N - 1)
			do people[i] :: 0
		end for
		var A: int :: cui@input().toInt(&) - 1
		do people[A] :: 1
		do que.add(A)
		var num: int :: 0
		while(^que <> 0)
			var p: int :: que.get()
			for i(0, ^friends[p] - 1)
				var f: int :: friends[p][i]
				if(people[f] = 0)
					do people[f] :: people[p] + 1
					do num :+ 1
					do que.add(f)
				else
					if(people[p] + 1 < people[f])
						do people[f] :: people[p] + 1
					end if
				end if
			end for
		end while
		var len: int :: 0
		for i(0, N - 1)
			if(people[i] > len)
				do len :: people[i]
			end if
		end for
		do len :- 1
		var ans: int :: 0
		while(2 ^ ans < len)
			do ans :+ 1
		end while
		do cui@print("\{num} \{ans}\n")
	end for
end func
0