Submission #716093

# Submission time Handle Problem Language Result Execution time Memory
716093 2023-03-29T02:21:24 Z vjudge1 Difference (POI11_roz) Python 3
30 / 100
1000 ms 5876 KB
n = int(input())
s = input()

alph = "abcdefghijklmnopqrstuvwxyz"

def m(s):
  max = 0
  min = 10**7
  for i in range(0, len(alph)):
    e=s.count(alph[i])
    if e == 0:
      continue
    if e>max:
      max = e
    if e<min:
      min = e
      
  return max-min
  
greatest = 0
for i in range(0, n):
  for j in range(i+1, n+1):
    
    r = m(s[i:j])
    if r>greatest:
      greatest = r

print(greatest)
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 14 ms 2860 KB Output is correct
3 Correct 15 ms 2824 KB Output is correct
4 Correct 14 ms 2872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 22 ms 2832 KB Output is correct
3 Correct 16 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 2820 KB Output is correct
2 Correct 57 ms 2768 KB Output is correct
3 Correct 44 ms 2832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 2772 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 2848 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 3156 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 5792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 5876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 5868 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 5868 KB Time limit exceeded
2 Halted 0 ms 0 KB -