19362022-12-12 07:46:39CodeBreakersKvázi-Izogrampython3Time limit exceeded 80/1001.075s14308 KiB
#import sys
#sys.stdin=open("input1.txt","r")

x=0
abc = 'abcdefghijklmnopqrstuvwxyz'
n=int(input())
mondatok=[]
for i in range(n):
    mondat=input()
    mondatok.append(mondat)

def fgv(t):
    for k in range(len(t)):
        c = 0
        for l in range(len(t)):
            if t[k]==t[l]:
                c+=1
                if t[k] not in abc:
                    c -= 1
                if c > 2:
                    return 0
    if c<=2:
        return 1

for i in mondatok:
    a = ""
    for j in i.split():
        for k in j:
            a+=k
    x+=fgv(a.lower())
print(x)

SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted18ms11164 KiB
2Accepted17ms11608 KiB
subtask230/30
3Accepted16ms11512 KiB
4Accepted17ms11856 KiB
5Accepted17ms12064 KiB
6Accepted20ms12176 KiB
7Accepted54ms13528 KiB
subtask350/50
8Accepted26ms12240 KiB
9Accepted26ms12344 KiB
10Accepted28ms12272 KiB
11Accepted29ms12840 KiB
12Accepted30ms12564 KiB
13Accepted32ms12876 KiB
subtask40/20
14Accepted96ms13084 KiB
15Accepted172ms13408 KiB
16Accepted333ms13832 KiB
17Accepted647ms14308 KiB
18Time limit exceeded1.054s6856 KiB
19Time limit exceeded1.075s7144 KiB
20Time limit exceeded1.054s7104 KiB