CSES - Datatähti 2018 loppu - Results
Submission details
Task:Tietoverkko
Sender:Uolevi
Submission time:2018-01-18 16:39:37 +0200
Language:Python3
Status:READY
Result:28
Feedback
groupverdictscore
#1ACCEPTED28
#20
Test results
testverdicttimegroup
#1ACCEPTED0.14 s1details
#2ACCEPTED0.15 s1details
#3ACCEPTED0.21 s1details
#4ACCEPTED0.47 s1details
#5ACCEPTED0.08 s1details
#6--2details
#7--2details
#8--2details
#9--2details
#10--2details

Code

n = int(input())
m = {}
c=0
v = []
counter = 0
for i in range(1,1+n):
	m[i] = []
for i in range(n):
	a,b = input().split()
	a = int(a)
	b = int(b)
	m[a].append(b)
	m[b].append(a)

for i in range(0,100):
	for i,j in m.items():
		counter = 0	
		if len(j) == 1:
			v.append(i)
		else:
			for x in range(len(j)):
				if j[x-counter] in v:
					del j[x-counter]
					counter += 1
					#print(j[x-counter])
				
for i in range(1,1+len(m)):
	if len(m[i]) == 1:
		c+=1
print(c)

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
100
16 88
6 77
60 92
98 64
...

correct output
97

user output
97

Test 2

Group: 1

Verdict: ACCEPTED

input
100
97 41
95 93
79 60
5 4
...

correct output
95

user output
95

Test 3

Group: 1

Verdict: ACCEPTED

input
100
87 24
21 49
86 85
42 32
...

correct output
90

user output
90

Test 4

Group: 1

Verdict: ACCEPTED

input
100
30 24
54 79
51 6
80 29
...

correct output
50

user output
50

Test 5

Group: 1

Verdict: ACCEPTED

input
100
11 27
54 59
100 90
2 95
...

correct output
0

user output
0

Test 6

Group: 2

Verdict:

input
100000
98276 76171
70684 49183
48756 661
17166 16972
...

correct output
99997

user output
(empty)

Test 7

Group: 2

Verdict:

input
100000
35903 47275
13566 84
58018 42495
57071 4451
...

correct output
99995

user output
(empty)

Test 8

Group: 2

Verdict:

input
100000
79209 94485
60266 86793
27501 19927
13544 59730
...

correct output
99000

user output
(empty)

Test 9

Group: 2

Verdict:

input
100000
68402 82703
12892 46068
60013 40753
26168 34434
...

correct output
90000

user output
(empty)

Test 10

Group: 2

Verdict:

input
100000
37330 74855
54324 45726
61652 15611
79081 47339
...

correct output
0

user output
(empty)