Submission #3239843
Source Code Expand
# -*- coding: utf-8 -*- """ Created on Sat Sep 22 16:27:11 2018 @author: maezawa """ from collections import deque n = int(input()) adj = [[] for _ in range(n+1)] for i in range(n-1): ai, bi = list(map(int, input().split())) adj[ai].append(bi) adj[bi].append(ai) #print(adj) node = [0]*(n+1) f = 1 s = n node[f] = 1 node[s] = -1 stack1 = deque([f]) stack2 = deque([s]) cnt1 = 0 cnt2 = 0 turn = 1 while stack1 or stack2: turn += 1 if stack1: f = stack1.pop() for m1 in adj[f]: if node[m1] != 0: continue else: node[m1] = turn stack1.append(m1) if stack2: s = stack2.pop() for m2 in adj[s]: if node[m2] != 0: continue else: node[m2] = -turn stack2.append(m2) cnt = 0 for i in node: if i>0: cnt += 1 elif i<0: cnt -= 1 if cnt > 0: print('Fennec') else: print('Snuke')
Submission Info
Submission Time | |
---|---|
Task | D - Fennec VS. Snuke |
User | km1216jp |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 1106 Byte |
Status | WA |
Exec Time | 494 ms |
Memory | 31696 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 20 ms | 3316 KB |
00_example_02.txt | AC | 20 ms | 3316 KB |
01.txt | AC | 20 ms | 3316 KB |
02.txt | AC | 20 ms | 3316 KB |
03.txt | AC | 20 ms | 3316 KB |
04.txt | WA | 20 ms | 3316 KB |
05.txt | WA | 428 ms | 26348 KB |
06.txt | AC | 447 ms | 28048 KB |
07.txt | AC | 406 ms | 26448 KB |
08.txt | AC | 448 ms | 28044 KB |
09.txt | AC | 21 ms | 3316 KB |
10.txt | AC | 409 ms | 26312 KB |
11.txt | AC | 442 ms | 27788 KB |
12.txt | WA | 440 ms | 27280 KB |
13.txt | AC | 467 ms | 29452 KB |
14.txt | WA | 482 ms | 29912 KB |
15.txt | AC | 482 ms | 28548 KB |
16.txt | AC | 489 ms | 31632 KB |
17.txt | AC | 487 ms | 31696 KB |
18.txt | AC | 481 ms | 31632 KB |
19.txt | AC | 494 ms | 31604 KB |