Submission #1211482


Source Code Expand

Copy
// AtCoder Regular Contest 071
// E - TrBBnsformBBtion

#include <cstdio>
#include <cstring>
#define P 5
#define MAX_S 100000
using namespace std;
typedef long long int ll;


char S[2][MAX_S + 2];
int L[2], sum_a[2][MAX_S + 1];
int Q;


int main() {

  int a, b, c, d;

  scanf("%s", &S[0]);
  scanf("%*c%s", &S[1]);
  for (int j = 0; j < 2; j++) {
    L[j] = strlen(S[j]);
    sum_a[j][0] = 0;
    for (int i = 1; i <= L[j]; i++) {
      sum_a[j][i] = sum_a[j][i - 1] + (S[j][i - 1] == 'A' ? 1 : 0);
    }
  }

  scanf("%d", &Q);
  for (int q = 0; q < Q; q++) {
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if ( ((b - a + 1 - 2 * (sum_a[0][b] - sum_a[0][a - 1])) - (d - c + 1 - 2 * (sum_a[1][d] - sum_a[1][c - 1]))) % 3 == 0 ) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }


  return 0;

}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:21:20: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[100002]’ [-Wformat=]
   scanf("%s", &S[0]);
                    ^
./Main.cpp:22:23: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[100002]’ [-Wformat=]
   scanf("%*c%s", &S[1]);
                       ^
./Main.cpp:21:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", &S[0]);
                     ^
./Main.cpp:22:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%*c%s", &S[1]);
                        ^
./Main.cpp:31:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &Q);
                  ^
./Main.cpp:33:38: warning: ignoring return value of ‘int sc...

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 600 / 600 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 1 ms 128 KB
0_001.txt 1 ms 128 KB
bound_0.txt 32 ms 1408 KB
bound_1.txt 38 ms 1536 KB
bound_2.txt 34 ms 1408 KB
bound_3.txt 37 ms 1408 KB
min.txt 1 ms 128 KB
rnd_10000_10.txt 36 ms 1408 KB
rnd_10000_10000.txt 36 ms 1408 KB
rnd_10000_2.txt 37 ms 1408 KB
rnd_10_10.txt 36 ms 1408 KB
rnd_10_10000.txt 36 ms 1408 KB
rnd_10_2.txt 37 ms 1408 KB
rnd_2_10.txt 38 ms 1408 KB
rnd_2_10000.txt 36 ms 1408 KB
rnd_2_2.txt 36 ms 1408 KB