Submission #3608574
Source Code Expand
#include <limits.h> #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define int long long #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i) #define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i) #define REV(i, a, b) for (int i = (a); i >= (b); --i) #define CLR(a, b) memset((a), (b), sizeof(a)) #define DUMP(x) cout << #x << " = " << (x) << endl; #define INF 1001001001001001001ll #define fcout cout << fixed << setprecision(10) using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string S, T; cin >> S >> T; vector<int> sums(S.size() + 1); REP(i, S.size()) { sums[i + 1] = sums[i]; sums[i + 1] += S[i] == 'A' ? 1 : 2; } vector<int> sumt(T.size() + 1); REP(i, T.size()) { sumt[i + 1] = sumt[i]; sumt[i + 1] += T[i] == 'A' ? 1 : 2; } int q; cin >> q; while (q--) { int a, b, c, d; cin >> a >> b >> c >> d; if ((sums[b] - sums[a - 1]) % 3 == (sumt[d] - sumt[c - 1]) % 3) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - TrBBnsformBBtion |
User | tatsumack |
Language | C++14 (GCC 5.4.1) |
Score | 600 |
Code Size | 1664 Byte |
Status | AC |
Exec Time | 191 ms |
Memory | 2512 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 600 / 600 | ||||
Status |
|
|
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 | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
bound_0.txt | AC | 183 ms | 2512 KB |
bound_1.txt | AC | 190 ms | 2512 KB |
bound_2.txt | AC | 186 ms | 2512 KB |
bound_3.txt | AC | 189 ms | 2512 KB |
min.txt | AC | 1 ms | 256 KB |
rnd_10000_10.txt | AC | 187 ms | 2512 KB |
rnd_10000_10000.txt | AC | 187 ms | 2512 KB |
rnd_10000_2.txt | AC | 188 ms | 2512 KB |
rnd_10_10.txt | AC | 190 ms | 2512 KB |
rnd_10_10000.txt | AC | 191 ms | 2512 KB |
rnd_10_2.txt | AC | 187 ms | 2512 KB |
rnd_2_10.txt | AC | 188 ms | 2512 KB |
rnd_2_10000.txt | AC | 191 ms | 2512 KB |
rnd_2_2.txt | AC | 190 ms | 2512 KB |