Submission #2115999
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;
const int MAX_N = 1e5 + 10;
int N[2]; char Ns[2][MAX_N];
int As[2][MAX_N], Bs[2][MAX_N];
int main() {
scanf("%s%s", Ns[0]+1, Ns[1]+1);
for(int k=0; k<2; k++) {
N[k] = strlen(Ns[k]+1);
for(int i=1; i<=N[k]; i++) {
As[k][i] = As[k][i-1] + (Ns[k][i] == 'A');
Bs[k][i] = Bs[k][i-1] + (Ns[k][i] == 'B');
}
}
int Q; cin >> Q;
while(Q--) {
int l[2], r[2]; scanf("%d%d%d%d", &l[0], &r[0], &l[1], &r[1]);
int cnt[2];
for(int k=0; k<2; k++) {
cnt[k] = 0;
cnt[k] += (As[k][r[k]] - As[k][l[k]-1]);
cnt[k] += (Bs[k][r[k]] - Bs[k][l[k]-1]) * 2;
cnt[k] %= 3;
}
if(cnt[0] == cnt[1]) puts("YES"); else puts("NO");
}
return 0;
}
Submission Info
Submission Time |
|
Task |
E - TrBBnsformBBtion |
User |
kajebiii |
Language |
C++14 (GCC 5.4.1) |
Score |
600 |
Code Size |
960 Byte |
Status |
AC |
Exec Time |
38 ms |
Memory |
2304 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:19:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s%s", Ns[0]+1, Ns[1]+1);
^
./Main.cpp:30:64: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int l[2], r[2]; scanf("%d%d%d%d", &l[0], &r[0], &l[1], &r[1]);
^
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 |
33 ms |
2304 KB |
bound_1.txt |
AC |
36 ms |
2304 KB |
bound_2.txt |
AC |
36 ms |
2304 KB |
bound_3.txt |
AC |
38 ms |
2304 KB |
min.txt |
AC |
1 ms |
256 KB |
rnd_10000_10.txt |
AC |
38 ms |
2304 KB |
rnd_10000_10000.txt |
AC |
38 ms |
2304 KB |
rnd_10000_2.txt |
AC |
38 ms |
2304 KB |
rnd_10_10.txt |
AC |
38 ms |
2304 KB |
rnd_10_10000.txt |
AC |
38 ms |
2304 KB |
rnd_10_2.txt |
AC |
38 ms |
2304 KB |
rnd_2_10.txt |
AC |
38 ms |
2304 KB |
rnd_2_10000.txt |
AC |
38 ms |
2304 KB |
rnd_2_2.txt |
AC |
38 ms |
2304 KB |