結果

問題 No.2677 Minmax Independent Set
ユーザー hato336hato336
提出日時 2024-03-15 22:28:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 824 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 122,672 KB
最終ジャッジ日時 2024-03-15 22:28:39
合計ジャッジ時間 21,498 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
85,080 KB
testcase_01 AC 135 ms
85,080 KB
testcase_02 AC 138 ms
85,080 KB
testcase_03 WA -
testcase_04 AC 143 ms
85,080 KB
testcase_05 AC 414 ms
113,880 KB
testcase_06 AC 407 ms
113,880 KB
testcase_07 AC 438 ms
113,880 KB
testcase_08 AC 405 ms
113,880 KB
testcase_09 AC 426 ms
113,880 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 403 ms
113,752 KB
testcase_13 AC 476 ms
117,296 KB
testcase_14 AC 446 ms
116,968 KB
testcase_15 AC 470 ms
116,772 KB
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 AC 376 ms
119,120 KB
testcase_29 AC 417 ms
113,880 KB
testcase_30 AC 133 ms
85,080 KB
testcase_31 AC 132 ms
85,080 KB
testcase_32 AC 131 ms
85,080 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 252 ms
102,232 KB
testcase_51 AC 169 ms
89,432 KB
testcase_52 AC 379 ms
115,380 KB
testcase_53 AC 328 ms
114,856 KB
testcase_54 AC 162 ms
89,432 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 289 ms
115,800 KB
testcase_61 WA -
testcase_62 AC 291 ms
113,880 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
#n = int(input())
#
#s = input()
n = int(input())
edge = [[] for i in range(n)]
for i in range(n-1):
    u,v = map(int,input().split())
    u-=1
    v-=1
    edge[u].append(v)
    edge[v].append(u)
color = [0 for i in range(n)]
start = 0
d = collections.deque()
dist = [10**18 for i in range(n)]
d.append(start)
dist[start] = 0
while d:
    now = d.popleft()
    for i in edge[now]:
        if dist[i] > dist[now] + 1:
            color[i] = color[now] ^ 1
            dist[i] = dist[now] + 1
            d.append(i)
x = sum(1 if color[i] == 0 else 0 for i in range(n))
y = sum(1 if color[i] == 1 else 0 for i in range(n))
print(min(x,y))
0