Submission #6919785
Source Code Expand
from collections import defaultdict import sys sys.setrecursionlimit(10**7) n = int(input()) edge = defaultdict(list) for i in range(n): a, b = map(int, input().split()) edge[a].append(b) edge[b].append(a) def dfs(now, prev, visited = []): if now in visited: print_ans(len(visited) - visited.index(now)) exit() else: for e in edge[now]: if e == prev: continue visited.append(now) ret = dfs(e, now, visited) visited.pop() return def print_ans(length): ans_min = 1 ans_max = n if length == n: ans_min = 2 if length % 2 == 1: ans_max = n-1 print(str(ans_min) + ' ' + str(ans_max)) dfs(1, 1)
Submission Info
Submission Time | |
---|---|
Task | C - 最小カットと最大カット |
User | tsb2b |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 800 Byte |
Status | TLE |
Exec Time | 2106 ms |
Memory | 38236 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | scrambled_00.txt, scrambled_01.txt, scrambled_02.txt, scrambled_03.txt, scrambled_04.txt, scrambled_05.txt, scrambled_06.txt, scrambled_07.txt, scrambled_08.txt, scrambled_09.txt, scrambled_10.txt, scrambled_11.txt, scrambled_12.txt, scrambled_13.txt, scrambled_14.txt, scrambled_15.txt, scrambled_16.txt, scrambled_17.txt, scrambled_18.txt, scrambled_19.txt, scrambled_20.txt, scrambled_21.txt, scrambled_22.txt, scrambled_23.txt, scrambled_24.txt, scrambled_25.txt, scrambled_26.txt, scrambled_27.txt, scrambled_28.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
scrambled_00.txt | AC | 20 ms | 3316 KB |
scrambled_01.txt | AC | 20 ms | 3316 KB |
scrambled_02.txt | AC | 20 ms | 3316 KB |
scrambled_03.txt | TLE | 2106 ms | 38236 KB |
scrambled_04.txt | TLE | 2106 ms | 38136 KB |
scrambled_05.txt | TLE | 2106 ms | 30032 KB |
scrambled_06.txt | TLE | 2104 ms | 26356 KB |
scrambled_07.txt | TLE | 2106 ms | 36964 KB |
scrambled_08.txt | TLE | 2105 ms | 25196 KB |
scrambled_09.txt | TLE | 2105 ms | 26240 KB |
scrambled_10.txt | AC | 407 ms | 28360 KB |
scrambled_11.txt | AC | 176 ms | 11864 KB |
scrambled_12.txt | AC | 318 ms | 21112 KB |
scrambled_13.txt | AC | 305 ms | 20376 KB |
scrambled_14.txt | AC | 558 ms | 27008 KB |
scrambled_15.txt | AC | 360 ms | 18764 KB |
scrambled_16.txt | AC | 187 ms | 11244 KB |
scrambled_17.txt | AC | 171 ms | 11364 KB |
scrambled_18.txt | AC | 474 ms | 27116 KB |
scrambled_19.txt | AC | 54 ms | 5160 KB |
scrambled_20.txt | AC | 321 ms | 17344 KB |
scrambled_21.txt | AC | 171 ms | 11372 KB |
scrambled_22.txt | AC | 318 ms | 18608 KB |
scrambled_23.txt | AC | 213 ms | 12408 KB |
scrambled_24.txt | AC | 198 ms | 11720 KB |
scrambled_25.txt | AC | 225 ms | 15224 KB |
scrambled_26.txt | AC | 206 ms | 12008 KB |
scrambled_27.txt | AC | 285 ms | 17292 KB |
scrambled_28.txt | AC | 269 ms | 16288 KB |