11549 | 2024-10-26 12:45:37 | balint | Periodikus Szavak | python3 | Time limit exceeded 41/100 | 592ms | 3568 KiB |
def main():
input()
text = input()
for _ in range(int(input())):
l, r = map(int, input().strip().split())
sub_text = text[l:r+1]
chars_len = len(set(sub_text))
len_sub_text = r+1-l
for i in range(chars_len, len_sub_text//2+1):
if len_sub_text % i == 0:
repeated_part = sub_text[:i]
if repeated_part * (len_sub_text // i) == sub_text:
print("YES")
break
else:
print("NO")
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 14ms | 3128 KiB | ||||
subtask2 | 14/14 | ||||||
2 | Accepted | 16ms | 3148 KiB | ||||
3 | Accepted | 17ms | 3128 KiB | ||||
4 | Accepted | 16ms | 3028 KiB | ||||
5 | Accepted | 17ms | 3128 KiB | ||||
6 | Accepted | 16ms | 3084 KiB | ||||
7 | Accepted | 17ms | 3128 KiB | ||||
8 | Accepted | 16ms | 3060 KiB | ||||
9 | Accepted | 17ms | 3084 KiB | ||||
10 | Accepted | 17ms | 3136 KiB | ||||
11 | Accepted | 17ms | 3144 KiB | ||||
12 | Accepted | 17ms | 3132 KiB | ||||
subtask3 | 27/27 | ||||||
13 | Accepted | 50ms | 3144 KiB | ||||
14 | Accepted | 46ms | 3144 KiB | ||||
15 | Accepted | 48ms | 3128 KiB | ||||
16 | Accepted | 18ms | 3124 KiB | ||||
17 | Accepted | 43ms | 3128 KiB | ||||
18 | Accepted | 46ms | 3128 KiB | ||||
19 | Accepted | 46ms | 3084 KiB | ||||
20 | Accepted | 28ms | 3024 KiB | ||||
21 | Accepted | 48ms | 3320 KiB | ||||
22 | Accepted | 54ms | 3072 KiB | ||||
subtask4 | 0/59 | ||||||
23 | Time limit exceeded | 583ms | 3128 KiB | ||||
24 | Accepted | 149ms | 3316 KiB | ||||
25 | Time limit exceeded | 583ms | 3140 KiB | ||||
26 | Time limit exceeded | 583ms | 3184 KiB | ||||
27 | Time limit exceeded | 583ms | 3128 KiB | ||||
28 | Time limit exceeded | 582ms | 3128 KiB | ||||
29 | Time limit exceeded | 582ms | 3128 KiB | ||||
30 | Time limit exceeded | 582ms | 3156 KiB | ||||
31 | Time limit exceeded | 589ms | 3552 KiB | ||||
32 | Time limit exceeded | 583ms | 3544 KiB | ||||
33 | Time limit exceeded | 584ms | 3132 KiB | ||||
34 | Time limit exceeded | 584ms | 3476 KiB | ||||
35 | Time limit exceeded | 579ms | 3552 KiB | ||||
36 | Time limit exceeded | 580ms | 3568 KiB | ||||
37 | Time limit exceeded | 582ms | 3488 KiB | ||||
38 | Time limit exceeded | 582ms | 3516 KiB | ||||
39 | Time limit exceeded | 578ms | 3520 KiB | ||||
40 | Time limit exceeded | 591ms | 3536 KiB | ||||
41 | Time limit exceeded | 592ms | 3520 KiB |