Submission #2980352
Source Code Expand
#include <bits/stdc++.h> using namespace std; string a, b; int A[100050], B[100050]; int main(){ cin >> a >> b; int n=a.length(), m=b.length(); for(int i = 0; i<n; i++){ if(a[i] == 'A') A[i+1]=1; else A[i+1]=2; } for(int i = 0; i<m; i++){ if(b[i] == 'A') B[i+1]=1; else B[i+1]=2; } for(int i = 1; i<=n; i++) A[i]+=A[i-1]; for(int i = 1; i<=m; i++) B[i]+=B[i-1]; int q; cin >> q; while(q--){ int c, d, e, f; cin >> c >> d >> e >> f; if((A[d]-A[c-1])%3 == (B[f]-B[e-1])%3) cout << "YES\n"; else cout << "NO\n"; } }
Submission Info
Submission Time | |
---|---|
Task | E - TrBBnsformBBtion |
User | tch1001 |
Language | C++14 (GCC 5.4.1) |
Score | 600 |
Code Size | 566 Byte |
Status | AC |
Exec Time | 319 ms |
Memory | 1792 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 | 276 ms | 1664 KB |
bound_1.txt | AC | 291 ms | 1664 KB |
bound_2.txt | AC | 301 ms | 1664 KB |
bound_3.txt | AC | 319 ms | 1792 KB |
min.txt | AC | 1 ms | 256 KB |
rnd_10000_10.txt | AC | 307 ms | 1664 KB |
rnd_10000_10000.txt | AC | 304 ms | 1664 KB |
rnd_10000_2.txt | AC | 304 ms | 1664 KB |
rnd_10_10.txt | AC | 307 ms | 1664 KB |
rnd_10_10000.txt | AC | 306 ms | 1664 KB |
rnd_10_2.txt | AC | 303 ms | 1664 KB |
rnd_2_10.txt | AC | 304 ms | 1664 KB |
rnd_2_10000.txt | AC | 308 ms | 1664 KB |
rnd_2_2.txt | AC | 301 ms | 1664 KB |