CSES - Datatähti 2016 alku - Results
Submission details
Task:Osajono
Sender:Allu
Submission time:2015-09-29 01:02:43
Language:Python3
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.07 s1details
#20.07 s1details
#30.08 s1details
#40.08 s1details
#50.08 s1details
#60.08 s2details
#70.09 s2details
#80.09 s2details
#90.09 s2details
#100.09 s2details
#11--3details
#120.31 s3details
#13--3details
#14--3details
#15--3details

Code

def f(n):
	if n == 1:
		return 0
	s=1
	for i in range(1, n+1):
		s*=i
	return s

inp = input()
num = len(inp)
d = {}
l = ""

for a in inp:
	if a in l:
		d[a] += 1
	else:
		d[a] = 1
		l += a

print(d)

for n in d.values():
	num += f(n) / (2 * f(n-2))

print (num)

Test details

Test 1

Group: 1

Verdict:

input
BBBAABBBAAAABBAAAABAABAABBBBBB...

correct output
2554

user output
{'B': 52, 'A': 48}
2554.0

Test 2

Group: 1

Verdict:

input
GDFVYWQCZAFGICSXOSWBZMGPDBSSVL...

correct output
299

user output
{'J': 1, 'W': 7, 'A': 2, 'Q': ...

Error:
Traceback (most recent call last):
  File "input/code.py", line 24, in <module>
    num += f(n) / (2 * f(n-2))
ZeroDivisionError: division by zero

Test 3

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAZAAAA...

correct output
4314

user output
{'A': 92, 'Z': 8}
4314.0

Test 4

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4231

user output
{'Z': 9, 'A': 91}
4231.0

Test 5

Group: 1

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5050

user output
{'Q': 100}
5050.0

Test 6

Group: 2

Verdict:

input
BBABABBBABBAABBABBABAABAAABABA...

correct output
6253029

user output
{'B': 2523, 'A': 2477}
6253029.0

Test 7

Group: 2

Verdict:

input
RBKJMLDVQMKHYKCNDIVVKOMFUXTFMG...

correct output
485173

user output
{'N': 197, 'L': 185, 'K': 185,...

Test 8

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12427725

user output
{'Z': 15, 'A': 4985}
12427725.0

Test 9

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12467549

user output
{'A': 4993, 'Z': 7}
12467549.0

Test 10

Group: 2

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
12502500

user output
{'Q': 5000}
12502500.0

Test 11

Group: 3

Verdict:

input
BAAAAABABBABAABAABABABBBABBAAB...

correct output
2500051369

user output
(empty)

Test 12

Group: 3

Verdict:

input
ABBURXDRVXAYBPXXOQZNYHLWGUEEWR...

correct output
192407124

user output
{'C': 3895, 'Y': 3916, 'D': 38...

Test 13

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998050400

user output
(empty)

Test 14

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998850144

user output
(empty)

Test 15

Group: 3

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5000050000

user output
(empty)