Submission #2978312
Source Code Expand
#include<iostream> #include<set> #include <bitset> #include<queue> #include<vector> #include<map> #include<stack> #include <cstdio> #include<algorithm> #include <sstream> #include<string> #include<string.h> #include <cmath> #include <iomanip> #include <string> #include<list> #include <limits> #include <numeric> #include <type_traits> #define int long long #define ll long long #define mod 1000000007 #define inf 1e17 #define rep(i,j,n) for(int i=j;i<n;i++) #define P pair<int,int> double pi = 3.141592653589793; using namespace std; //ここから始めよう int sa[114514],sb[114511],ta[114514],tb[114514]; signed main(){ string s,t;cin>>s>>t; sa[0]=0,sb[0]=0,ta[0]=0,tb[0]=0; rep(i,0,s.size()){ if(s[i]=='A'){ sa[i+1]=sa[i]+1; sb[i+1]=sb[i]; } if(s[i]=='B'){ sa[i+1]=sa[i]; sb[i+1]=sb[i]+1; } } rep(i,0,t.size()){ if(t[i]=='A'){ ta[i+1]=ta[i]+1; tb[i+1]=tb[i]; } if(t[i]=='B'){ ta[i+1]=ta[i]; tb[i+1]=tb[i]+1; } } int q;cin>>q; rep(i,0,q){ int a,b,c,d;cin>>a>>b>>c>>d; int saa=sa[b]-sa[a-1],sbb=sb[b]-sb[a-1]; int taa=ta[d]-ta[c-1],tbb=tb[d]-tb[c-1]; int sum=saa*2+sbb-tbb-taa*2; //cout<<saa<<" "<<sbb<<" "<<taa<<" "<<tbb<<" "; // cout<<sum<<" "; if(sum%3==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - TrBBnsformBBtion |
User | birdway |
Language | C++14 (GCC 5.4.1) |
Score | 600 |
Code Size | 1546 Byte |
Status | AC |
Exec Time | 293 ms |
Memory | 4096 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 | 257 ms | 4096 KB |
bound_1.txt | AC | 277 ms | 4096 KB |
bound_2.txt | AC | 278 ms | 4096 KB |
bound_3.txt | AC | 287 ms | 4096 KB |
min.txt | AC | 1 ms | 256 KB |
rnd_10000_10.txt | AC | 279 ms | 4096 KB |
rnd_10000_10000.txt | AC | 279 ms | 4096 KB |
rnd_10000_2.txt | AC | 278 ms | 4096 KB |
rnd_10_10.txt | AC | 276 ms | 4096 KB |
rnd_10_10000.txt | AC | 279 ms | 4096 KB |
rnd_10_2.txt | AC | 281 ms | 4096 KB |
rnd_2_10.txt | AC | 293 ms | 4096 KB |
rnd_2_10000.txt | AC | 283 ms | 4096 KB |
rnd_2_2.txt | AC | 283 ms | 4096 KB |