Skip to content

Commit

Permalink
Add kattis prob dunglish in py3
Browse files Browse the repository at this point in the history
  • Loading branch information
iandioch committed Mar 20, 2018
1 parent 462651f commit 53f8562
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions kattis/dunglish/solution.py
@@ -0,0 +1,32 @@
from collections import defaultdict
correct = defaultdict(int)
incorrect = defaultdict(int)

trans = {}

input()
sentence = input().strip().split()
n = int(input())
for _ in range(n):
d, e, corr = input().split()
trans[d] = e
if corr == 'correct':
correct[d] += 1
else:
incorrect[d] += 1

tot = 1
ok = 1
for word in sentence:
ok *= correct[word]
tot *= (correct[word] + incorrect[word])

if tot == 1:
print(' '.join(trans[s] for s in sentence))
if ok == 0:
print('incorrect')
else:
print('correct')
else:
print(ok, 'correct')
print(tot-ok, 'incorrect')

0 comments on commit 53f8562

Please sign in to comment.