11548 | 2024-10-26 12:14:51 | balint | Periodikus Szavak | python3 | Time limit exceeded 41/100 | 587ms | 3504 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 and (len_sub_text // i) * 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 | 3128 KiB | ||||
3 | Accepted | 17ms | 3076 KiB | ||||
4 | Accepted | 17ms | 3128 KiB | ||||
5 | Accepted | 17ms | 3068 KiB | ||||
6 | Accepted | 17ms | 2940 KiB | ||||
7 | Accepted | 17ms | 3128 KiB | ||||
8 | Accepted | 17ms | 3092 KiB | ||||
9 | Accepted | 17ms | 3128 KiB | ||||
10 | Accepted | 16ms | 3092 KiB | ||||
11 | Accepted | 17ms | 3132 KiB | ||||
12 | Accepted | 17ms | 2996 KiB | ||||
subtask3 | 27/27 | ||||||
13 | Accepted | 48ms | 3156 KiB | ||||
14 | Accepted | 48ms | 3128 KiB | ||||
15 | Accepted | 50ms | 3136 KiB | ||||
16 | Accepted | 18ms | 3132 KiB | ||||
17 | Accepted | 41ms | 3060 KiB | ||||
18 | Accepted | 48ms | 3128 KiB | ||||
19 | Accepted | 50ms | 3016 KiB | ||||
20 | Accepted | 28ms | 2996 KiB | ||||
21 | Accepted | 48ms | 3120 KiB | ||||
22 | Accepted | 54ms | 3128 KiB | ||||
subtask4 | 0/59 | ||||||
23 | Time limit exceeded | 580ms | 3128 KiB | ||||
24 | Accepted | 152ms | 3128 KiB | ||||
25 | Time limit exceeded | 582ms | 3320 KiB | ||||
26 | Time limit exceeded | 583ms | 3384 KiB | ||||
27 | Time limit exceeded | 583ms | 2984 KiB | ||||
28 | Time limit exceeded | 583ms | 2992 KiB | ||||
29 | Time limit exceeded | 584ms | 3168 KiB | ||||
30 | Time limit exceeded | 584ms | 3128 KiB | ||||
31 | Time limit exceeded | 584ms | 3480 KiB | ||||
32 | Time limit exceeded | 583ms | 3444 KiB | ||||
33 | Time limit exceeded | 583ms | 3128 KiB | ||||
34 | Time limit exceeded | 583ms | 3452 KiB | ||||
35 | Time limit exceeded | 579ms | 3444 KiB | ||||
36 | Time limit exceeded | 586ms | 3480 KiB | ||||
37 | Time limit exceeded | 586ms | 3480 KiB | ||||
38 | Time limit exceeded | 586ms | 3468 KiB | ||||
39 | Time limit exceeded | 587ms | 3504 KiB | ||||
40 | Time limit exceeded | 578ms | 3448 KiB | ||||
41 | Time limit exceeded | 578ms | 3496 KiB |