Submission #1679807


Source Code Expand

#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back

using namespace std;

char s[111111], t[111111];
int ps[111111], pt[111111];
int q;

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%s%s%d",&s,&t,&q);
	int n = strlen(s);
	for(int i = 0; i < n; ++i){
		if (s[i] == 'A') ps[i + 1] = 1;
		else ps[i + 1] = 2;
		ps[i + 1] += ps[i];
	}
	n = strlen(t);
	for(int i = 0; i < n; ++i){
		if (t[i] == 'A') pt[i + 1] = 1;
		else pt[i + 1] = 2;
		pt[i + 1] += pt[i];
	}
	while (q--){
		int a, b, c, d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if ((pt[d] - pt[c - 1] - ps[b] + ps[a - 1]) % 3 == 0){
			printf("YES\n");
		}
		else printf("NO\n");
	}
	return 0;
}

Submission Info

Submission Time
Task E - TrBBnsformBBtion
User Minology
Language C++14 (GCC 5.4.1)
Score 600
Code Size 705 Byte
Status AC
Exec Time 37 ms
Memory 1536 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:25: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[111111]’ [-Wformat=]
  scanf("%s%s%d",&s,&t,&q);
                         ^
./Main.cpp:14:25: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘char (*)[111111]’ [-Wformat=]
./Main.cpp:14:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s%s%d",&s,&t,&q);
                          ^
./Main.cpp:29:32: 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);
                                ^

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 32 ms 1536 KB
bound_1.txt AC 35 ms 1536 KB
bound_2.txt AC 35 ms 1536 KB
bound_3.txt AC 37 ms 1536 KB
min.txt AC 1 ms 256 KB
rnd_10000_10.txt AC 37 ms 1536 KB
rnd_10000_10000.txt AC 37 ms 1536 KB
rnd_10000_2.txt AC 37 ms 1536 KB
rnd_10_10.txt AC 37 ms 1536 KB
rnd_10_10000.txt AC 37 ms 1536 KB
rnd_10_2.txt AC 37 ms 1536 KB
rnd_2_10.txt AC 37 ms 1536 KB
rnd_2_10000.txt AC 37 ms 1536 KB
rnd_2_2.txt AC 37 ms 1536 KB