結果

問題 No.812 Change of Class
ユーザー 👑 tatt61880tatt61880
提出日時 2019-04-12 23:42:41
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 1,273 bytes
コンパイル時間 2,798 ms
コンパイル使用メモリ 173,816 KB
実行使用メモリ 18,668 KB
最終ジャッジ日時 2023-10-14 15:44:43
合計ジャッジ時間 14,803 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
15,328 KB
testcase_01 AC 34 ms
5,328 KB
testcase_02 AC 119 ms
9,948 KB
testcase_03 AC 266 ms
17,404 KB
testcase_04 AC 229 ms
15,824 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 7 ms
6,944 KB
testcase_08 AC 4 ms
4,964 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 33 ms
13,020 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,372 KB
testcase_14 AC 2 ms
4,372 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 51 ms
6,256 KB
testcase_36 AC 20 ms
4,684 KB
testcase_37 AC 129 ms
8,596 KB
testcase_38 AC 13 ms
7,556 KB
testcase_39 AC 135 ms
8,580 KB
testcase_40 AC 32 ms
5,216 KB
testcase_41 AC 10 ms
7,176 KB
testcase_42 AC 305 ms
13,032 KB
testcase_43 AC 67 ms
10,776 KB
testcase_44 AC 205 ms
10,268 KB
testcase_45 AC 20 ms
4,808 KB
testcase_46 AC 60 ms
10,504 KB
testcase_47 AC 202 ms
10,276 KB
testcase_48 AC 226 ms
12,284 KB
testcase_49 AC 55 ms
5,804 KB
testcase_50 AC 3 ms
4,368 KB
testcase_51 AC 60 ms
7,008 KB
testcase_52 AC 120 ms
11,212 KB
testcase_53 AC 37 ms
5,044 KB
testcase_54 AC 30 ms
4,952 KB
testcase_55 AC 181 ms
13,744 KB
testcase_56 AC 205 ms
15,484 KB
testcase_57 AC 224 ms
16,416 KB
testcase_58 AC 118 ms
10,212 KB
testcase_59 AC 264 ms
18,008 KB
testcase_60 AC 1 ms
4,372 KB
testcase_61 AC 2 ms
4,372 KB
testcase_62 AC 2 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

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: []list<int> :: #[N]list<int>
	for i(0, N - 1)
		do friends[i] :: #list<int>
	end for
	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].add(q)
		do friends[q].add(p)
	end for
	var Q: int :: cui@input().toInt(&)
	
	var st: stack<int> :: #stack<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 st.add(A)
		var num: int :: 0
		while(^st <> 0)
			var p: int :: st.get()
			do friends[p].head()
			for i(0, ^friends[p] - 1)
				var f: int :: friends[p].get()
				do friends[p].next()
				if(people[f] = 0)
					do people[f] :: people[p] + 1
					do num :+ 1
					do st.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