Submission #1294909


Source Code Expand

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
    string s,t;
    cin>>s>>t;
    
    vector<int> cs(s.size()+1,0),ct(t.size()+1,0);
    
    rep(i,s.size()){
        if(s[i]=='A')cs[i+1]=1;
        else cs[i+1]=2;
    }
    rep(i,t.size()){
        if(t[i]=='A')ct[i+1]=1;
        else ct[i+1]=2;
    }
    rep(i,cs.size()-1)cs[i+1]+=cs[i];
    rep(i,ct.size()-1)ct[i+1]+=ct[i];
    
    int q;
    cin>>q;
    rep(i,q){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        a--,b--,c--,d--;
        
        int x=cs[b+1]-cs[a], y=ct[d+1]-ct[c];
        
        if(abs(x-y)%3==0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

Submission Info

Submission Time
Task E - TrBBnsformBBtion
User Yazaten
Language C++14 (GCC 5.4.1)
Score 600
Code Size 889 Byte
Status AC
Exec Time 282 ms
Memory 1664 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 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
bound_0.txt AC 251 ms 1664 KB
bound_1.txt AC 269 ms 1664 KB
bound_2.txt AC 265 ms 1664 KB
bound_3.txt AC 282 ms 1664 KB
min.txt AC 1 ms 256 KB
rnd_10000_10.txt AC 273 ms 1664 KB
rnd_10000_10000.txt AC 274 ms 1664 KB
rnd_10000_2.txt AC 277 ms 1664 KB
rnd_10_10.txt AC 274 ms 1664 KB
rnd_10_10000.txt AC 275 ms 1664 KB
rnd_10_2.txt AC 280 ms 1664 KB
rnd_2_10.txt AC 277 ms 1664 KB
rnd_2_10000.txt AC 275 ms 1664 KB
rnd_2_2.txt AC 277 ms 1664 KB