Submission #1371062
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
char a[100010], b[100010];
int na, nb, q, s[2][2][100010];
void sum(int n, char *b, int t){
for(int i = 1; i <= n; i++){
for(int j = 0; j < 2; j++) s[t][j][i] = s[t][j][i - 1];
s[t][(b[i] == 'B')][i]++;
}
}
int main(){
scanf("%s%s", a + 1, b + 1);
na = strlen(a + 1);
nb = strlen(b + 1);
sum(na, a, 0);
sum(nb, b, 1);
scanf("%d", &q);
for(int a, b, c, d; q--; ){
scanf("%d%d%d%d", &a, &b, &c, &d); a--; c--;
puts(((s[0][0][b] - s[0][0][a] - s[0][1][b] + s[0][1][a] -
s[1][0][d] + s[1][0][c] + s[1][1][d] - s[1][1][c] + 300000) % 3) ? "NO" : "YES");
}
}
Submission Info
Submission Time |
|
Task |
E - TrBBnsformBBtion |
User |
kdh9949 |
Language |
C++14 (GCC 5.4.1) |
Score |
600 |
Code Size |
650 Byte |
Status |
AC |
Exec Time |
38 ms |
Memory |
2304 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:15:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s%s", a + 1, b + 1);
^
./Main.cpp:20:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &q);
^
./Main.cpp:22:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d%d", &a, &b, &c, &d); a--; c--;
^
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 |
34 ms |
2304 KB |
bound_1.txt |
AC |
37 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 |