Submission #1521342


Source Code Expand

/**
 * Copyright (c) 2017, xehoth
 * All rights reserved.
 * 「ARC 071E」TrBBnsformBBtion 20-08-2017
 *
 * @author xehoth
 */
#include <bits/stdc++.h>

namespace Task {

#define long long long

const int MAXN = 1000000;

char s[MAXN + 1], t[MAXN + 1];

const int MOD = 1e9 + 7;
int qa[MAXN], qb[MAXN], n, x, y, X, Y;
char a[MAXN], b[MAXN];

inline void solve() {
    std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL);
    std::cin >> a + 1 >> b + 1;
    for (int i = 1; a[i]; i++) qa[i] = qa[i - 1] + a[i] - 'A' + 1;
    for (int i = 1; b[i]; i++) qb[i] = qb[i - 1] + b[i] - 'A' + 1;
    for (std::cin >> n; n--;) {
        std::cin >> x >> y >> X >> Y;
        puts((qa[y] - qa[x - 1]) % 3 == (qb[Y] - qb[X - 1]) % 3 ? "YES" : "NO");
    }
}

#undef long
}

int main() {
    Task::solve();
    return 0;
}

Submission Info

Submission Time
Task E - TrBBnsformBBtion
User xehoth
Language C++14 (GCC 5.4.1)
Score 600
Code Size 870 Byte
Status AC
Exec Time 39 ms
Memory 7040 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 2 ms 2304 KB
0_001.txt AC 1 ms 2304 KB
bound_0.txt AC 33 ms 7040 KB
bound_1.txt AC 35 ms 7040 KB
bound_2.txt AC 35 ms 7040 KB
bound_3.txt AC 38 ms 7040 KB
min.txt AC 2 ms 2304 KB
rnd_10000_10.txt AC 37 ms 7040 KB
rnd_10000_10000.txt AC 37 ms 7040 KB
rnd_10000_2.txt AC 37 ms 7040 KB
rnd_10_10.txt AC 39 ms 7040 KB
rnd_10_10000.txt AC 37 ms 7040 KB
rnd_10_2.txt AC 37 ms 7040 KB
rnd_2_10.txt AC 37 ms 7040 KB
rnd_2_10000.txt AC 37 ms 7040 KB
rnd_2_2.txt AC 37 ms 7040 KB