Submission #1371254


Source Code Expand

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 15;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

char in1[100050];
char in2[100050];
int sum1[100050];
int sum2[100050];
int main() {
	scanf("%s %s", in1 + 1, in2 + 1);
	int N = strlen(in1 + 1), M = strlen(in2 + 1), i;
	for (i = 1; i <= N; i++) sum1[i] = sum1[i - 1] + (in1[i] == 'A' ? 1 : -1);
	for (i = 1; i <= M; i++) sum2[i] = sum2[i - 1] + (in2[i] == 'A' ? 1 : -1);

	int Q, t1, t2, t3, t4;
	scanf("%d", &Q);
	while (Q--) {
		scanf("%d %d %d %d", &t1, &t2, &t3, &t4);
		int v1 = sum1[t2] - sum1[t1 - 1];
		int v2 = sum2[t4] - sum2[t3 - 1];
		if ((v1 - v2) % 3) printf("NO\n");
		else printf("YES\n");
	}
	return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:58:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s %s", in1 + 1, in2 + 1);
                                  ^
./Main.cpp:64:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &Q);
                 ^
./Main.cpp:66:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d %d", &t1, &t2, &t3, &t4);
                                           ^

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 33 ms 1536 KB
bound_1.txt AC 36 ms 1536 KB
bound_2.txt AC 35 ms 1536 KB
bound_3.txt AC 38 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