Submission #3012041
Source Code Expand
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//ここまでテンプレ
int main(){
string S,T;
cin>>S>>T;
vint A,B;
A.pb(0);
B.pb(0);
for(int i=0;i<S.length();i++){
if(S[i]=='A')
A.pb(1);
else
A.pb(2);
}
for(int i=0;i<T.length();i++){
if(T[i]=='A')
B.pb(1);
else
B.pb(2);
}
for(int i=1;i<=S.length();i++)
A[i]+=A[i-1];
for(int i=1;i<=T.length();i++)
B[i]+=B[i-1];
int Q;
cin>>Q;
while(Q--){
int a,b,c,d;
cin>>a>>b>>c>>d;
if((A[b]-A[a-1])%3==(B[d]-B[c-1])%3)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
E - TrBBnsformBBtion |
User |
takeo1116 |
Language |
C++14 (GCC 5.4.1) |
Score |
600 |
Code Size |
1549 Byte |
Status |
AC |
Exec Time |
284 ms |
Memory |
1788 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 |
254 ms |
1788 KB |
bound_1.txt |
AC |
268 ms |
1788 KB |
bound_2.txt |
AC |
267 ms |
1788 KB |
bound_3.txt |
AC |
284 ms |
1788 KB |
min.txt |
AC |
2 ms |
384 KB |
rnd_10000_10.txt |
AC |
275 ms |
1788 KB |
rnd_10000_10000.txt |
AC |
275 ms |
1788 KB |
rnd_10000_2.txt |
AC |
277 ms |
1788 KB |
rnd_10_10.txt |
AC |
275 ms |
1788 KB |
rnd_10_10000.txt |
AC |
281 ms |
1788 KB |
rnd_10_2.txt |
AC |
274 ms |
1788 KB |
rnd_2_10.txt |
AC |
278 ms |
1788 KB |
rnd_2_10000.txt |
AC |
277 ms |
1788 KB |
rnd_2_2.txt |
AC |
277 ms |
1788 KB |