Submission #3013743


Source Code Expand

s = input()
t = input()
q = int(input())

sa_pre = [s[i] == "A" for i in range(len(s))]
ta_pre = [t[i] == "A" for i in range(len(t))]

sa = [0, sa_pre[0]]
ta = [0, ta_pre[0]]

for i in range(1, len(s)):
	sa.append(sa[-1] + sa_pre[i])

for i in range(1, len(t)):
	ta.append(ta[-1] + ta_pre[i])

def check(a, b, c, d):
	xa = sa[b] - sa[a - 1]
	ya = ta[d] - ta[c - 1]
	if (2 * xa - (b - a + 1)) % 3 == (2 * ya - (d - c + 1)) % 3:
		print("YES")
		return
	else:
		print("NO")
		return

for _ in range(q):
	a, b, c, d = map(int, input().split())
	check(a, b, c, d)

Submission Info

Submission Time
Task E - TrBBnsformBBtion
User anagohirame
Language Python (3.4.3)
Score 600
Code Size 587 Byte
Status AC
Exec Time 1296 ms
Memory 13040 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 2
AC × 16
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, bound_0.txt, bound_1.txt, bound_2.txt, bound_3.txt, min.txt, rnd_10000_10.txt, rnd_10000_10000.txt, rnd_10000_2.txt, rnd_10_10.txt, rnd_10_10000.txt, rnd_10_2.txt, rnd_2_10.txt, rnd_2_10000.txt, rnd_2_2.txt
Case Name Status Exec Time Memory
0_000.txt AC 17 ms 3064 KB
0_001.txt AC 18 ms 3064 KB
bound_0.txt AC 1027 ms 13036 KB
bound_1.txt AC 1027 ms 13040 KB
bound_2.txt AC 1019 ms 13036 KB
bound_3.txt AC 1068 ms 13036 KB
min.txt AC 17 ms 3064 KB
rnd_10000_10.txt AC 1030 ms 13036 KB
rnd_10000_10000.txt AC 1048 ms 13036 KB
rnd_10000_2.txt AC 1296 ms 12884 KB
rnd_10_10.txt AC 1079 ms 13036 KB
rnd_10_10000.txt AC 1041 ms 13036 KB
rnd_10_2.txt AC 1053 ms 13036 KB
rnd_2_10.txt AC 1041 ms 13036 KB
rnd_2_10000.txt AC 1029 ms 13036 KB
rnd_2_2.txt AC 1057 ms 13040 KB