結果
問題 | No.812 Change of Class |
ユーザー | mkawa2 |
提出日時 | 2021-02-20 15:16:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 551 ms / 4,000 ms |
コード長 | 1,409 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 82,184 KB |
実行使用メモリ | 104,492 KB |
最終ジャッジ日時 | 2024-09-17 16:11:47 |
合計ジャッジ時間 | 15,401 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 202 ms
92,360 KB |
testcase_01 | AC | 97 ms
78,160 KB |
testcase_02 | AC | 147 ms
86,760 KB |
testcase_03 | AC | 224 ms
95,404 KB |
testcase_04 | AC | 205 ms
92,584 KB |
testcase_05 | AC | 551 ms
95,100 KB |
testcase_06 | AC | 450 ms
91,128 KB |
testcase_07 | AC | 47 ms
70,788 KB |
testcase_08 | AC | 38 ms
63,320 KB |
testcase_09 | AC | 461 ms
99,780 KB |
testcase_10 | AC | 493 ms
98,764 KB |
testcase_11 | AC | 79 ms
97,264 KB |
testcase_12 | AC | 347 ms
102,680 KB |
testcase_13 | AC | 40 ms
54,968 KB |
testcase_14 | AC | 40 ms
54,848 KB |
testcase_15 | AC | 391 ms
91,688 KB |
testcase_16 | AC | 99 ms
77,704 KB |
testcase_17 | AC | 376 ms
93,012 KB |
testcase_18 | AC | 271 ms
88,516 KB |
testcase_19 | AC | 312 ms
91,920 KB |
testcase_20 | AC | 534 ms
97,968 KB |
testcase_21 | AC | 261 ms
88,500 KB |
testcase_22 | AC | 154 ms
82,812 KB |
testcase_23 | AC | 88 ms
77,288 KB |
testcase_24 | AC | 80 ms
77,512 KB |
testcase_25 | AC | 131 ms
82,356 KB |
testcase_26 | AC | 395 ms
96,012 KB |
testcase_27 | AC | 387 ms
92,572 KB |
testcase_28 | AC | 277 ms
90,928 KB |
testcase_29 | AC | 112 ms
78,464 KB |
testcase_30 | AC | 324 ms
91,564 KB |
testcase_31 | AC | 330 ms
89,548 KB |
testcase_32 | AC | 171 ms
84,260 KB |
testcase_33 | AC | 343 ms
94,868 KB |
testcase_34 | AC | 86 ms
77,204 KB |
testcase_35 | AC | 141 ms
82,396 KB |
testcase_36 | AC | 93 ms
77,512 KB |
testcase_37 | AC | 224 ms
84,688 KB |
testcase_38 | AC | 62 ms
78,920 KB |
testcase_39 | AC | 224 ms
84,700 KB |
testcase_40 | AC | 102 ms
78,452 KB |
testcase_41 | AC | 54 ms
76,376 KB |
testcase_42 | AC | 370 ms
91,164 KB |
testcase_43 | AC | 116 ms
95,172 KB |
testcase_44 | AC | 276 ms
86,800 KB |
testcase_45 | AC | 91 ms
77,644 KB |
testcase_46 | AC | 107 ms
94,832 KB |
testcase_47 | AC | 280 ms
88,828 KB |
testcase_48 | AC | 299 ms
91,196 KB |
testcase_49 | AC | 124 ms
79,212 KB |
testcase_50 | AC | 57 ms
71,976 KB |
testcase_51 | AC | 130 ms
84,328 KB |
testcase_52 | AC | 173 ms
92,260 KB |
testcase_53 | AC | 111 ms
78,152 KB |
testcase_54 | AC | 109 ms
78,048 KB |
testcase_55 | AC | 175 ms
93,340 KB |
testcase_56 | AC | 195 ms
96,732 KB |
testcase_57 | AC | 197 ms
96,292 KB |
testcase_58 | AC | 135 ms
88,428 KB |
testcase_59 | AC | 219 ms
104,492 KB |
testcase_60 | AC | 35 ms
55,692 KB |
testcase_61 | AC | 34 ms
56,192 KB |
testcase_62 | AC | 34 ms
54,988 KB |
ソースコード
import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.buffer.readline()) def FI(): return float(sys.stdin.buffer.readline()) def MI(): return map(int, sys.stdin.buffer.readline().split()) def MF(): return map(float, sys.stdin.buffer.readline().split()) def MI1(): return map(int1, sys.stdin.buffer.readline().split()) def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def LI1(): return list(map(int1, sys.stdin.buffer.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def BI(): return sys.stdin.buffer.readline().rstrip() def SI(): return sys.stdin.buffer.readline().rstrip().decode() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] inf = 10**16 # md = 998244353 md = 10**9+7 from collections import deque n, m = MI() to = [[] for _ in range(n)] for _ in range(m): u, v = MI1() to[u].append(v) to[v].append(u) for _ in range(II()): a = II()-1 dist = [inf]*n dist[a] = 0 q = deque() q.append(a) d = 1 while q: u = q.popleft() d = dist[u] for v in to[u]: if dist[v] == inf: dist[v] = d+1 q.append(v) friend = n-dist.count(inf)-1 day = 0 if friend == 0 else (d-1).bit_length() print(friend, day)